From 744a967961e6e0949487ba7dead3897b025a359b Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Sat, 17 Aug 2024 13:41:17 -0400 Subject: [PATCH 1/2] Implemented breadcrumbs component --- Client/src/Components/Breadcrumbs/index.css | 31 ++++++++++++++ Client/src/Components/Breadcrumbs/index.jsx | 42 +++++++++++++++++++ Client/src/Pages/Monitors/Configure/index.jsx | 23 ++++------ Client/src/assets/icons/right-arrow.svg | 3 ++ 4 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 Client/src/Components/Breadcrumbs/index.css create mode 100644 Client/src/Components/Breadcrumbs/index.jsx create mode 100644 Client/src/assets/icons/right-arrow.svg diff --git a/Client/src/Components/Breadcrumbs/index.css b/Client/src/Components/Breadcrumbs/index.css new file mode 100644 index 000000000..28f75a4b4 --- /dev/null +++ b/Client/src/Components/Breadcrumbs/index.css @@ -0,0 +1,31 @@ +.MuiBreadcrumbs-root { + height: 36px; +} +.MuiBreadcrumbs-root svg { + width: 16px; + height: 16px; +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-li a { + font-size: var(--env-var-font-size-medium); + color: var(--env-var-color-2); + opacity: 0.8; + font-weight: 400; +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-li:hover a { + color: var(--env-var-color-2); +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child):hover a { + opacity: 1; + background-color: #e3e3e3; +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-li:not(:last-child) { + cursor: pointer; +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-li:last-child a { + font-weight: 600; + opacity: 1; + cursor: default; +} +.MuiBreadcrumbs-root .MuiBreadcrumbs-separator { + margin: 0; +} diff --git a/Client/src/Components/Breadcrumbs/index.jsx b/Client/src/Components/Breadcrumbs/index.jsx new file mode 100644 index 000000000..adaf6315b --- /dev/null +++ b/Client/src/Components/Breadcrumbs/index.jsx @@ -0,0 +1,42 @@ +import { Box, Breadcrumbs as MUIBreadcrumbs } from "@mui/material"; +import { useTheme } from "@emotion/react"; +import { useNavigate } from "react-router"; +import ArrowRight from "../../assets/icons/right-arrow.svg?react"; + +import "./index.css"; + +const Breadcrumbs = ({ list }) => { + const theme = useTheme(); + const navigate = useNavigate(); + + return ( + } + aria-label="breadcrumb" + p={theme.gap.small} + width="fit-content" + backgroundColor={theme.palette.otherColors.fillGray} + borderRadius={`${theme.shape.borderRadius}px`} + lineHeight="18px" + > + {list.map((item, index) => { + return ( + navigate(item.path)} + > + {item.name} + + ); + })} + + ); +}; + +export default Breadcrumbs; diff --git a/Client/src/Pages/Monitors/Configure/index.jsx b/Client/src/Pages/Monitors/Configure/index.jsx index 08c8cbe39..a572e9151 100644 --- a/Client/src/Pages/Monitors/Configure/index.jsx +++ b/Client/src/Pages/Monitors/Configure/index.jsx @@ -21,6 +21,7 @@ import { deleteUptimeMonitor, } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import Checkbox from "../../../Components/Inputs/Checkbox"; +import Breadcrumbs from "../../../Components/Breadcrumbs"; /** * Parses a URL string and returns a URL object. @@ -220,20 +221,12 @@ const Configure = () => { ) : ( <> -