-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverview-stats.tsx
57 lines (54 loc) · 1.52 KB
/
overview-stats.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"use client";
import { random } from "@/lib/utils";
import { Card, Metric, Text, AreaChart, BadgeDelta, Flex } from "@tremor/react";
import { useMemo } from "react";
export default function OverviewStats() {
const data = useMemo(() => {
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
return [
...months.map((month) => ({
Month: `${month} 23`,
"Total Visitors": random(20000, 170418),
})),
{
Month: "Jul 23",
"Total Visitors": 170418,
},
];
}, []);
return (
<div className="grid gap-6 sm:grid-cols-2">
<Card className="dark:!bg-stone-900">
<Text>Total Visitors</Text>
<Flex
className="space-x-3 truncate"
justifyContent="start"
alignItems="baseline"
>
<Metric className="font-cal">170,418</Metric>
<BadgeDelta
deltaType="moderateIncrease"
className="dark:bg-green-900 dark:bg-opacity-50 dark:text-green-400"
>
34.3%
</BadgeDelta>
</Flex>
<AreaChart
className="mt-6 h-28"
data={data}
index="Month"
valueFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`
}
categories={["Total Visitors"]}
colors={["blue"]}
showXAxis={true}
showGridLines={false}
startEndOnly={true}
showYAxis={false}
showLegend={false}
/>
</Card>
</div>
);
}