diff --git a/app/components/ui/card-report.tsx b/app/components/ui/card-report.tsx index ce746e6..cb85a9e 100644 --- a/app/components/ui/card-report.tsx +++ b/app/components/ui/card-report.tsx @@ -1,15 +1,16 @@ import { GraphIcon } from '~/components/icons/graph' +import { formatNumberWithPeriods } from '~/utils/formatter' interface CardReportProperty { title: string - amound?: number | string + amount: number url?: string type?: 'history' | 'report' counter?: number[] } export const CardReport = (properties: CardReportProperty) => { - const { title, amound } = properties + const { title, amount } = properties return ( <>
@@ -20,7 +21,9 @@ export const CardReport = (properties: CardReportProperty) => { />

{title}

-

Rp. {amound}

+

+ Rp. {formatNumberWithPeriods(amount)} +

diff --git a/app/layouts/news/form-login.tsx b/app/layouts/news/form-login.tsx index 003b530..2cb5a84 100644 --- a/app/layouts/news/form-login.tsx +++ b/app/layouts/news/form-login.tsx @@ -12,7 +12,7 @@ const loginSchema = z.object({ password: z.string().min(6, 'Kata sandi minimal 6 karakter'), }) -export type TLoginSchema = z.infer +type TLoginSchema = z.infer type TProperties = { setIsRegisterOpen: Dispatch> diff --git a/app/pages/dashboard/data.ts b/app/pages/dashboard/data.ts index a4cb5aa..4769cd3 100644 --- a/app/pages/dashboard/data.ts +++ b/app/pages/dashboard/data.ts @@ -1,7 +1,7 @@ export const REPORT = [ - { title: 'Total Transaksi', amound: '10.800.000.000', icon: 'money' }, - { title: 'Transaksi Tertagih', amound: 2_000_000, icon: 'money' }, - { title: 'Transaksi Tertagih', amound: 2_000_000, icon: 'money' }, + { title: 'Total Transaksi', amount: 10_800_000_000, icon: 'money' }, + { title: 'Transaksi Tertagih', amount: 2_000_000, icon: 'money' }, + { title: 'Transaksi Tertagih', amount: 2_000_000, icon: 'money' }, ] export const HISTORY = [ diff --git a/app/pages/dashboard/index.tsx b/app/pages/dashboard/index.tsx index 71a72fb..a367217 100644 --- a/app/pages/dashboard/index.tsx +++ b/app/pages/dashboard/index.tsx @@ -22,12 +22,12 @@ export const DashboardPage = () => {
- {REPORT.map((report, index) => ( + {REPORT.map(({ title, amount }, index) => ( + title={title} + amount={amount} + /> ))}
diff --git a/app/utils/formatter.ts b/app/utils/formatter.ts new file mode 100644 index 0000000..9de8842 --- /dev/null +++ b/app/utils/formatter.ts @@ -0,0 +1,3 @@ +export const formatNumberWithPeriods = (number: number) => { + return new Intl.NumberFormat('id-ID').format(number) +}