-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathhome.jsx
More file actions
258 lines (255 loc) · 9.08 KB
/
home.jsx
File metadata and controls
258 lines (255 loc) · 9.08 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import React from "react";
import {
Typography,
Card,
CardHeader,
CardBody,
IconButton,
Menu,
MenuHandler,
MenuList,
MenuItem,
Avatar,
Tooltip,
Progress,
} from "@material-tailwind/react";
import {
EllipsisVerticalIcon,
ArrowUpIcon,
} from "@heroicons/react/24/outline";
import { StatisticsCard } from "@/widgets/cards";
import { StatisticsChart } from "@/widgets/charts";
import {
statisticsCardsData,
statisticsChartsData,
projectsTableData,
ordersOverviewData,
} from "@/data";
import { CheckCircleIcon, ClockIcon } from "@heroicons/react/24/solid";
export function Home() {
return (
<div className="mt-12">
<div className="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 xl:grid-cols-4">
{statisticsCardsData.map(({ icon, title, footer, ...rest }) => (
<StatisticsCard
key={title}
{...rest}
title={title}
icon={React.createElement(icon, {
className: "w-6 h-6 text-white",
})}
footer={
<Typography className="font-normal text-blue-gray-600">
<strong className={footer.color}>{footer.value}</strong>
{footer.label}
</Typography>
}
/>
))}
</div>
<div className="mb-6 grid grid-cols-1 gap-y-12 gap-x-6 md:grid-cols-2 xl:grid-cols-3">
{statisticsChartsData.map((props) => (
<StatisticsChart
key={props.title}
{...props}
footer={
<Typography
variant="small"
className="flex items-center font-normal text-blue-gray-600"
>
<ClockIcon strokeWidth={2} className="h-4 w-4 text-blue-gray-400" />
{props.footer}
</Typography>
}
/>
))}
</div>
<div className="mb-4 grid grid-cols-1 gap-6 xl:grid-cols-3">
<Card className="overflow-hidden xl:col-span-2 border border-blue-gray-100 shadow-sm">
<CardHeader
floated={false}
shadow={false}
color="transparent"
className="m-0 flex items-center justify-between p-6"
>
<div>
<Typography variant="h6" color="blue-gray" className="mb-1">
Projects
</Typography>
<Typography
variant="small"
className="flex items-center gap-1 font-normal text-blue-gray-600"
>
<CheckCircleIcon strokeWidth={3} className="h-4 w-4 text-blue-gray-200" />
<strong>30 done</strong> this month
</Typography>
</div>
<Menu placement="left-start">
<MenuHandler>
<IconButton size="sm" variant="text" color="blue-gray">
<EllipsisVerticalIcon
strokeWidth={3}
fill="currenColor"
className="h-6 w-6"
/>
</IconButton>
</MenuHandler>
<MenuList>
<MenuItem>Action</MenuItem>
<MenuItem>Another Action</MenuItem>
<MenuItem>Simulate Smiles</MenuItem>
</MenuList>
</Menu>
</CardHeader>
<CardBody className="overflow-x-scroll px-0 pt-0 pb-2">
<table className="w-full min-w-[640px] table-auto">
<thead>
<tr>
{["companies", "members", "budget", "completion"].map(
(el) => (
<th
key={el}
className="border-b border-blue-gray-50 py-3 px-6 text-left"
>
<Typography
variant="small"
className="text-[11px] font-medium uppercase text-blue-gray-400"
>
{el}
</Typography>
</th>
)
)}
</tr>
</thead>
<tbody>
{projectsTableData.map(
({ img, name, members, budget, completion }, key) => {
const className = `py-3 px-5 ${
key === projectsTableData.length - 1
? ""
: "border-b border-blue-gray-50"
}`;
return (
<tr key={name}>
<td className={className}>
<div className="flex items-center gap-4">
<Avatar src={img} alt={name} size="sm" />
<Typography
variant="small"
color="blue-gray"
className="font-bold"
>
{name}
</Typography>
</div>
</td>
<td className={className}>
{members.map(({ img, name }, key) => (
<Tooltip key={name} content={name}>
<Avatar
src={img}
alt={name}
size="xs"
variant="circular"
className={`cursor-pointer border-2 border-white ${
key === 0 ? "" : "-ml-2.5"
}`}
/>
</Tooltip>
))}
</td>
<td className={className}>
<Typography
variant="small"
className="text-xs font-medium text-blue-gray-600"
>
{budget}
</Typography>
</td>
<td className={className}>
<div className="w-10/12">
<Typography
variant="small"
className="mb-1 block text-xs font-medium text-blue-gray-600"
>
{completion}%
</Typography>
<Progress
value={completion}
variant="gradient"
color={completion === 100 ? "green" : "blue"}
className="h-1"
/>
</div>
</td>
</tr>
);
}
)}
</tbody>
</table>
</CardBody>
</Card>
<Card className="border border-blue-gray-100 shadow-sm">
<CardHeader
floated={false}
shadow={false}
color="transparent"
className="m-0 p-6"
>
<Typography variant="h6" color="blue-gray" className="mb-2">
Orders Overview
</Typography>
<Typography
variant="small"
className="flex items-center gap-1 font-normal text-blue-gray-600"
>
<ArrowUpIcon
strokeWidth={3}
className="h-3.5 w-3.5 text-green-500"
/>
<strong>24%</strong> this month
</Typography>
</CardHeader>
<CardBody className="pt-0">
{ordersOverviewData.map(
({ icon, color, title, description }, key) => (
<div key={title} className="flex items-start gap-4 py-3">
<div
className={`relative p-1 after:absolute after:-bottom-6 after:left-2/4 after:w-0.5 after:-translate-x-2/4 after:bg-blue-gray-50 after:content-[''] ${
key === ordersOverviewData.length - 1
? "after:h-0"
: "after:h-4/6"
}`}
>
{React.createElement(icon, {
className: `!w-5 !h-5 ${color}`,
})}
</div>
<div>
<Typography
variant="small"
color="blue-gray"
className="block font-medium"
>
{title}
</Typography>
<Typography
as="span"
variant="small"
className="text-xs font-medium text-blue-gray-500"
>
{description}
</Typography>
</div>
</div>
)
)}
</CardBody>
</Card>
</div>
</div>
);
}
export default Home;