35 lines
983 B
TypeScript

import type { ComponentType, SVGProps } from 'react'
import { formatNumberWithPeriods } from '~/utils/formatter'
type CardReportProperty = {
title: string
amount: number
currency?: string
icon: ComponentType<SVGProps<SVGSVGElement>>
url?: string
}
export const CardReport = (properties: CardReportProperty) => {
const { title, amount, icon: Icon, currency } = properties
return (
<div className="rounded-xl bg-white px-4 py-6 shadow-sm">
<div className="flex items-center">
<Icon
className="ml-2 rounded-xl bg-[#2E2F7C] p-2 text-white"
height={48}
width={48}
/>
<div className="ml-7">
<h2 className="text-lg font-semibold">{title}</h2>
<p className="text-2xl font-bold text-[#2E2F7C]">
{currency
? `${currency} ${formatNumberWithPeriods(amount)}`
: formatNumberWithPeriods(amount)}
</p>
</div>
</div>
</div>
)
}