From 540e639d3e75f5e9a10db6bf708d074bee28b2b7 Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Sat, 17 Aug 2024 13:42:36 -0400 Subject: [PATCH] Added docs --- Client/src/Components/Breadcrumbs/index.jsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Client/src/Components/Breadcrumbs/index.jsx b/Client/src/Components/Breadcrumbs/index.jsx index adaf6315b..506263fce 100644 --- a/Client/src/Components/Breadcrumbs/index.jsx +++ b/Client/src/Components/Breadcrumbs/index.jsx @@ -1,3 +1,4 @@ +import PropTypes from "prop-types"; import { Box, Breadcrumbs as MUIBreadcrumbs } from "@mui/material"; import { useTheme } from "@emotion/react"; import { useNavigate } from "react-router"; @@ -5,6 +6,17 @@ 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(); @@ -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;