import { formatMoney } from '@transferwise/formatting';
import { useIntl } from 'react-intl';

export interface MoneyProps {
  amount: number;
  currency: string;
  alwaysShowDecimals?: boolean;
}

const Money = ({ amount, currency, alwaysShowDecimals = false }: MoneyProps) => {
  const { locale } = useIntl();
  return (
    <>
      {formatMoney(amount, currency, locale, {
        alwaysShowDecimals,
      })}
    </>
  );
};

export default Money;
