← back to Watches

src/components/PriceDisplay.jsx

19 lines

import React from 'react';
import { formatPrice, CURRENCIES } from '../../config/currencies.js';

const PriceDisplay = ({ amount, currency = 'USD', originalCurrency, originalAmount, showOriginal = true }) => {
  const formatted = formatPrice(amount, currency);
  const curr = CURRENCIES[currency];

  return (
    <span className="inline-flex items-center" title={showOriginal && originalCurrency && originalCurrency !== currency ? `Originally ${formatPrice(originalAmount, originalCurrency)}` : undefined}>
      <span className="font-semibold">{formatted}</span>
      {showOriginal && originalCurrency && originalCurrency !== currency && (
        <span className="ml-1 text-xs text-gray-400">({formatPrice(originalAmount, originalCurrency)})</span>
      )}
    </span>
  );
};

export default PriceDisplay;