diff --git a/app/components/ui/chart.tsx b/app/components/ui/chart.tsx new file mode 100644 index 0000000..ed1074a --- /dev/null +++ b/app/components/ui/chart.tsx @@ -0,0 +1,66 @@ +import { + Chart as ChartJS, + ArcElement, + Tooltip, + Legend, + type ChartOptions, +} from 'chart.js' +import { Pie } from 'react-chartjs-2' +ChartJS.register(ArcElement, Tooltip, Legend) + +export const ChartPie = () => { + const data = { + labels: [ + 'Pidana', + 'Perdata', + 'Perceraian', + 'Surat Bisnis', + 'Surat Tanah', + 'Lainnya', + ], + datasets: [ + { + data: [33.7, 13, 22.8, 9.3, 9.3, 21.2], + backgroundColor: [ + '#FFB300', + '#4CAF50', + '#3F51B5', + '#F44336', + '#2196F3', + '#FF9800', + ], + hoverOffset: 4, + }, + ], + } + + const options: ChartOptions<'pie'> = { + maintainAspectRatio: true, + responsive: false, + plugins: { + legend: { + position: 'right', + labels: { + usePointStyle: true, + pointStyle: 'circle', + padding: 20, + }, + }, + }, + layout: { + padding: 0, + }, + } + + return ( +
+

Top 5 Konten

+ +
+ ) +} diff --git a/app/pages/dashboard/index.tsx b/app/pages/dashboard/index.tsx index a9b8029..72edebc 100644 --- a/app/pages/dashboard/index.tsx +++ b/app/pages/dashboard/index.tsx @@ -1,68 +1,55 @@ import { CardReport } from '~/components/ui/card-report' +import { ChartPie } from '~/components/ui/chart' import { HISTORY, REPORT } from './data' export const DashboardPage = () => { return (
-
-
-

Dashboard

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