diff --git a/app/components/icons/doctor.tsx b/app/components/icons/doctor.tsx new file mode 100644 index 0000000..72fae6f --- /dev/null +++ b/app/components/icons/doctor.tsx @@ -0,0 +1,21 @@ +import type { JSX, SVGProps } from 'react' + +export const DoctorIcon = ( + properties: JSX.IntrinsicAttributes & SVGProps, +) => { + return ( + + + + ) +} diff --git a/app/components/ui/card-report.tsx b/app/components/ui/card-report.tsx index 231e12f..a201e7a 100644 --- a/app/components/ui/card-report.tsx +++ b/app/components/ui/card-report.tsx @@ -1,20 +1,23 @@ -import { GraphIcon } from '~/components/icons/graph' +import type { JSX } from 'react' + import { formatNumberWithPeriods } from '~/utils/formatter' type CardReportProperty = { title: string amount: number + icon: ( + properties: React.JSX.IntrinsicAttributes & React.SVGProps, + ) => JSX.Element url?: string - type?: 'history' | 'report' counter?: number[] } export const CardReport = (properties: CardReportProperty) => { - const { title, amount } = properties + const { title, amount, icon: Icon, counter } = properties return ( - <> -
- +
+ {

- + {counter?.length && ( +
+ Pribadi: {counter[0]} | Perusahaan: {counter[1]} +
+ )} + ) } diff --git a/app/pages/dashboard/data.ts b/app/pages/dashboard/data.ts index 4769cd3..30f3ebb 100644 --- a/app/pages/dashboard/data.ts +++ b/app/pages/dashboard/data.ts @@ -1,20 +1,23 @@ +import { DoctorIcon } from '~/components/icons/doctor' +import { GraphIcon } from '~/components/icons/graph' + export const REPORT = [ - { 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' }, + { title: 'Total Transaksi', amount: 10_800_000_000, icon: GraphIcon }, + { title: 'Transaksi Tertagih', amount: 2_000_000, icon: GraphIcon }, + { title: 'Transaksi Tertagih', amount: 2_000_000, icon: GraphIcon }, ] export const HISTORY = [ { title: 'Total Kunjungan', - total: 1_000_000, - icon: 'money', + amount: 2890, + icon: GraphIcon, counter: [2190, 700], }, { title: 'Total User Memesan', - total: 274, - icon: 'money', + amount: 274, + icon: DoctorIcon, counter: [211, 54], }, ] diff --git a/app/pages/dashboard/index.tsx b/app/pages/dashboard/index.tsx index a367217..a9b8029 100644 --- a/app/pages/dashboard/index.tsx +++ b/app/pages/dashboard/index.tsx @@ -1,7 +1,6 @@ -import { GraphIcon } from '~/components/icons/graph' import { CardReport } from '~/components/ui/card-report' -import { REPORT } from './data' +import { HISTORY, REPORT } from './data' export const DashboardPage = () => { return (
@@ -22,45 +21,27 @@ export const DashboardPage = () => {
- {REPORT.map(({ title, amount }, index) => ( + {REPORT.map(({ title, amount, icon }, index) => ( ))}
-
-
- -
-

Total Kunjungan

-

2.890

-
-
-

Pribadi: 2.190 | Perusahaan: 700

-
-
-
- -
-

Total User Memesan

-

274

-
-
-

Pribadi: 211 | Perusahaan: 54

-
+ {HISTORY.map(({ title, amount, icon, counter }, index) => ( + + ))}