2025-02-24 09:31:48 +08:00
|
|
|
import type { JSX } from 'react'
|
|
|
|
|
|
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-02-24 09:31:48 +08:00
|
|
|
icon: (
|
|
|
|
|
properties: React.JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>,
|
|
|
|
|
) => JSX.Element
|
2025-02-23 23:17:06 +07:00
|
|
|
url?: string
|
|
|
|
|
counter?: number[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const CardReport = (properties: CardReportProperty) => {
|
2025-03-03 21:17:46 +07:00
|
|
|
const { title, amount, icon: Icon, counter, 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
|
|
|
{counter?.length && (
|
2025-03-03 21:17:46 +07:00
|
|
|
<div className="flex items-center pt-2">
|
2025-02-24 09:31:48 +08:00
|
|
|
Pribadi: {counter[0]} | Perusahaan: {counter[1]}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2025-02-23 23:17:06 +07:00
|
|
|
)
|
|
|
|
|
}
|