2025-03-15 22:25:06 +08:00
|
|
|
import type { ComponentType, SVGProps } from 'react'
|
2025-02-24 09:31:48 +08:00
|
|
|
|
2025-02-24 08:04:09 +08:00
|
|
|
import { formatNumberWithPeriods } from '~/utils/formatter'
|
2025-02-23 23:17:06 +07:00
|
|
|
|
2025-02-24 08:23:22 +08:00
|
|
|
type CardReportProperty = {
|
2025-02-23 23:17:06 +07:00
|
|
|
title: string
|
2025-02-24 08:04:09 +08:00
|
|
|
amount: number
|
2025-03-03 21:17:46 +07:00
|
|
|
currency?: string
|
2025-03-15 22:25:06 +08:00
|
|
|
icon: ComponentType<SVGProps<SVGSVGElement>>
|
2025-02-23 23:17:06 +07:00
|
|
|
url?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const CardReport = (properties: CardReportProperty) => {
|
2025-03-15 19:45:14 +08:00
|
|
|
const { title, amount, icon: Icon, currency } = properties
|
2025-02-24 00:54:00 +07:00
|
|
|
return (
|
2025-03-13 05:45:03 +08:00
|
|
|
<div className="rounded-xl bg-white px-4 py-6 shadow-sm">
|
2025-02-24 09:31:48 +08:00
|
|
|
<div className="flex items-center">
|
|
|
|
|
<Icon
|
2025-02-24 00:54:00 +07:00
|
|
|
className="ml-2 rounded-xl bg-[#2E2F7C] p-2 text-white"
|
|
|
|
|
height={48}
|
|
|
|
|
width={48}
|
|
|
|
|
/>
|
2025-03-03 21:17:46 +07:00
|
|
|
<div className="ml-7">
|
2025-02-24 00:54:00 +07:00
|
|
|
<h2 className="text-lg font-semibold">{title}</h2>
|
2025-02-24 08:04:09 +08:00
|
|
|
<p className="text-2xl font-bold text-[#2E2F7C]">
|
2025-03-03 21:17:46 +07:00
|
|
|
{currency
|
|
|
|
|
? `${currency} ${formatNumberWithPeriods(amount)}`
|
|
|
|
|
: formatNumberWithPeriods(amount)}
|
2025-02-24 08:04:09 +08:00
|
|
|
</p>
|
2025-02-23 23:17:06 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-02-24 09:31:48 +08:00
|
|
|
</div>
|
2025-02-23 23:17:06 +07:00
|
|
|
)
|
|
|
|
|
}
|