import type { PaymentCode } from "@/utils/requests/Types"; import moment from "moment"; import "moment/locale/fr"; import PaymentOption from "./PaymentOption"; import Box from "./bases/Box"; import Text from "./bases/Text"; interface Props { paymentType: PaymentCode; reference: string; date: string; amount: number; status: "SUCCESS" | "INITIATED" | "FAILED"; } moment.locale("fr"); const TransactionInformationsItem = ({ paymentType, reference, date, amount, status }: Props) => { // date = new Date(date); const dateObject = Date.parse(date); return ( {/* */} {}} /> {reference} {moment(dateObject).fromNow()} {/* {amount} */} ); }; const AmountColorRenderer = ({ status, amount }: { status: string; amount: number }) => { if (status === "SUCCESS") { return ( {amount} ); } if (status === "INITIATED") { return ( {amount} ); } return ( {amount} ); }; export default TransactionInformationsItem;