import React, { HTMLAttributes } from "react";
import { NumericFormat } from "react-number-format";
import clsx from "clsx";

const MoneyFormat = ({
  value,
  className,
  decimalScale = 0,
}: {
  value: number;
  className?: HTMLAttributes<HTMLSpanElement>["className"] | string;
  decimalScale?: number;
}) => {
  return (
    <NumericFormat
      className={clsx("w-fit bg-transparent text-inherit", className)}
      value={value}
      displayType={"text"}
      thousandSeparator={true}
      decimalScale={decimalScale}
      fixedDecimalScale={true}
      prefix={"NGN"}
    />
  );
};

export default MoneyFormat;
