export const PriceFormatter = (price, currency, currencyName) => {
  const supportedCurrencies = ["USD", "EUR", "GBP"];
  const symbolFormatter = supportedCurrencies.includes(currency)
    ? currency
    : undefined;

  const formatter = new Intl.NumberFormat("en", {
    style: symbolFormatter,
    currencyDisplay: "symbol",
    minimumFractionDigits: 2,
  });

  const displayCurrencyName = symbolFormatter ? "" : currencyName;

  return `${formatter.format(price)} ${displayCurrencyName}`;
};
