Implemented breadcrumbs component
This commit is contained in:
1 parent
c91e3ea1e4
commit
744a967961
4 files changed
+84
-15
No files matched your search
@@ -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;
|
||||
}
|
||||
@@ -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 (
|
||||
<MUIBreadcrumbs
|
||||
separator={<ArrowRight />}
|
||||
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 (
|
||||
<Box
|
||||
component="a"
|
||||
key={`${item.name}-${index}`}
|
||||
px={theme.gap.small}
|
||||
pt={theme.gap.xs}
|
||||
pb="6px"
|
||||
sx={{ textTransform: "capitalize" }}
|
||||
borderRadius={`${theme.shape.borderRadius}px`}
|
||||
onClick={() => navigate(item.path)}
|
||||
>
|
||||
{item.name}
|
||||
</Box>
|
||||
);
|
||||
})}
|
||||
</MUIBreadcrumbs>
|
||||
);
|
||||
};
|
||||
|
||||
export default Breadcrumbs;
|
||||
Reference in new issue
Block a user