Implemented breadcrumbs component

This commit is contained in:
Daniel Cojocea committed 2024-08-17 13:41:17 -04:00
1 parent c91e3ea1e4
commit 744a967961
4 files changed
+84 -15

No files matched your search

@@ -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;