diff --git a/public/images/avtar/avtar.png b/public/images/avtar/avtar.png new file mode 100644 index 0000000..c9fa46b Binary files /dev/null and b/public/images/avtar/avtar.png differ diff --git a/src/App.tsx b/src/App.tsx index 0a9dd76..86b8a6c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,17 +4,23 @@ import Sidebar from "./userComponents/Sidebar"; import Navbar from "./userComponents/Navbar"; import Dashboard from "./pages/Dashboard"; - const App = () => { return ( -
- -
- - - } /> - +
+
+ +
+ +
+
+ +
+
+ + } /> + +
diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..960e769 --- /dev/null +++ b/src/components/ui/breadcrumb.tsx @@ -0,0 +1,40 @@ +import { Breadcrumb, type SystemStyleObject } from "@chakra-ui/react" +import * as React from "react" + +export interface BreadcrumbRootProps extends Breadcrumb.RootProps { + separator?: React.ReactNode + separatorGap?: SystemStyleObject["gap"] +} + +export const BreadcrumbRoot = React.forwardRef< + HTMLDivElement, + BreadcrumbRootProps +>(function BreadcrumbRoot(props, ref) { + const { separator, separatorGap, children, ...rest } = props + + const validChildren = React.Children.toArray(children).filter( + React.isValidElement, + ) + + return ( + + + {validChildren.map((child, index) => { + const last = index === validChildren.length - 1 + return ( + + {child} + {!last && ( + {separator} + )} + + ) + })} + + + ) +}) + +export const BreadcrumbLink = Breadcrumb.Link +export const BreadcrumbCurrentLink = Breadcrumb.CurrentLink +export const BreadcrumbEllipsis = Breadcrumb.Ellipsis diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index f5fbd99..5620a1c 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -1,14 +1,12 @@ import React from "react"; -import { SimpleGrid } from "@chakra-ui/react"; +import { Box, SimpleGrid } from "@chakra-ui/react"; import DashboardCard from "../userComponents/DashboardCard"; const Dashboard = () => { return ( - - - - - + + + ); }; diff --git a/src/userComponents/Navbar.tsx b/src/userComponents/Navbar.tsx index 8fcfd64..45e4d65 100644 --- a/src/userComponents/Navbar.tsx +++ b/src/userComponents/Navbar.tsx @@ -1,14 +1,54 @@ import React from "react"; -import { Box, Flex, Text } from "@chakra-ui/react"; +import { Box, Flex, Image, Text } from "@chakra-ui/react"; +import { useLocation, Link } from "react-router-dom"; +import { IoMdNotificationsOutline } from "react-icons/io"; +import avtar from "../../public/images/avtar/avtar.png"; +import { + BreadcrumbCurrentLink, + BreadcrumbLink, + BreadcrumbRoot, +} from "../components/ui/breadcrumb"; + +const Navbar: React.FC = () => { + const location = useLocation(); + + const pathSegments = location.pathname + .split("/") + .filter((segment) => segment); + + const lastSegment = pathSegments[pathSegments.length - 1] || ""; -const Navbar = () => { return ( - - + + - Dashboard + + + Dashboard + + {pathSegments.map((segment, index) => { + const to = `/${pathSegments.slice(0, index + 1).join("/")}`; + return ( + + {segment.charAt(0).toUpperCase() + segment.slice(1)} + + ); + })} + + {lastSegment.charAt(0).toUpperCase() + lastSegment.slice(1)} + + - Welcome, User! + + + + + + + Jackson + + + ); diff --git a/src/userComponents/Sidebar.tsx b/src/userComponents/Sidebar.tsx index 030e6b4..3442a81 100644 --- a/src/userComponents/Sidebar.tsx +++ b/src/userComponents/Sidebar.tsx @@ -22,7 +22,7 @@ const Sidebar = () => { return ( { borderRadius="md" cursor="pointer" onClick={() => toggleSection(item.value)} - w="254px" + w="250px" >