Added docs
This commit is contained in:
1 parent
744a967961
commit
540e639d3e
1 file changed
+21
@@ -1,3 +1,4 @@
|
|||||||
|
import PropTypes from "prop-types";
|
||||||
import { Box, Breadcrumbs as MUIBreadcrumbs } from "@mui/material";
|
import { Box, Breadcrumbs as MUIBreadcrumbs } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
@@ -5,6 +6,17 @@ import ArrowRight from "../../assets/icons/right-arrow.svg?react";
|
|||||||
|
|
||||||
import "./index.css";
|
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 Breadcrumbs = ({ list }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -39,4 +51,13 @@ const Breadcrumbs = ({ list }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Breadcrumbs.propTypes = {
|
||||||
|
list: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
path: PropTypes.string.isRequired,
|
||||||
|
}).isRequired
|
||||||
|
).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
export default Breadcrumbs;
|
export default Breadcrumbs;
|
||||||
Reference in new issue
Block a user