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..506263fce --- /dev/null +++ b/Client/src/Components/Breadcrumbs/index.jsx @@ -0,0 +1,63 @@ +import PropTypes from "prop-types"; +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"; + +/** + * Breadcrumbs component that displays a list of breadcrumb items. + * + * @param {Object} props + * @param {Array} props.list - Array of breadcrumb items. Each item should have `name` and `path` properties. + * @param {string} props.list.name - The name to display for the breadcrumb. + * @param {string} props.list.path - The path to navigate to when the breadcrumb is clicked. + * + * @returns {JSX.Element} The rendered Breadcrumbs component. + */ + +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} + + ); + })} + + ); +}; + +Breadcrumbs.propTypes = { + list: PropTypes.arrayOf( + PropTypes.shape({ + name: PropTypes.string.isRequired, + path: PropTypes.string.isRequired, + }).isRequired + ).isRequired, +}; + +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 = () => { ) : ( <> -