-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathdashboard.jsx
More file actions
68 lines (61 loc) · 1.87 KB
/
dashboard.jsx
File metadata and controls
68 lines (61 loc) · 1.87 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
import { Routes, Route } from "react-router-dom";
import { useState } from "react";
import { Cog6ToothIcon } from "@heroicons/react/24/solid";
import { IconButton } from "@material-tailwind/react";
import { Outlet } from "react-router-dom";
import {
Sidenav,
DashboardNavbar,
Configurator,
Footer,
} from "@/widgets/layout";
import routes from "@/routes";
import { useMaterialTailwindController, setOpenConfigurator } from "@/context";
export function Dashboard() {
const [controller, dispatch] = useMaterialTailwindController();
const { sidenavType } = controller;
const [collapsed, setCollapsed] = useState(false);
return (
<div className="min-h-screen bg-blue-gray-50/50 flex">
<Sidenav
routes={routes}
brandImg={
sidenavType === "dark" ? "/img/logo-ct.png" : "/img/logo-ct-dark.png"
}
onCollapse={(value) => setCollapsed(value)}
/>
<div
className={`p-4 transition-all duration-300 w-full ${
collapsed ? "xl:ml-24" : "xl:ml-64"
}`}
>
<DashboardNavbar />
<Configurator />
<IconButton
size="lg"
color="white"
className="fixed bottom-8 right-8 z-40 rounded-full shadow-blue-gray-900/10"
ripple={false}
onClick={() => setOpenConfigurator(dispatch, true)}
>
<Cog6ToothIcon className="h-5 w-5" />
</IconButton>
<Routes>
{routes.map(
({ layout, pages }) =>
layout === "dashboard" &&
pages.map(({ path, element }) => (
<Route exact path={path} element={element} />
))
)}
</Routes>
<Outlet />
<div className="text-blue-gray-600">
<Footer />
</div>
</div>
</div>
);
}
Dashboard.displayName = "/src/layout/dashboard.jsx";
export default Dashboard;