import * as React from 'react'; import Box from '@mui/material/Box'; import List from '@mui/material/List'; import Link, { LinkProps } from '@mui/material/Link'; import { ListItemProps } from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import Collapse from '@mui/material/Collapse'; import ListItemText from '@mui/material/ListItemText'; import Typography from '@mui/material/Typography'; import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandMore from '@mui/icons-material/ExpandMore'; import Breadcrumbs from '@mui/material/Breadcrumbs'; import { Link as RouterLink, Route, Routes, MemoryRouter, useLocation, } from 'react-router'; interface ListItemLinkProps extends ListItemProps { to: string; open?: boolean; } const breadcrumbNameMap: { [key: string]: string } = { '/inbox': 'Inbox', '/inbox/important': 'Important', '/trash': 'Trash', '/spam': 'Spam', '/drafts': 'Drafts', }; function ListItemLink(props: ListItemLinkProps) { const { to, open, ...other } = props; const primary = breadcrumbNameMap[to]; let icon = null; if (open != null) { icon = open ? : ; } return (
  • {icon}
  • ); } interface LinkRouterProps extends LinkProps { to: string; replace?: boolean; } function LinkRouter(props: LinkRouterProps) { return ; } function Page() { const location = useLocation(); const pathnames = location.pathname.split('/').filter((x) => x); return ( Home {pathnames.map((value, index) => { const last = index === pathnames.length - 1; const to = `/${pathnames.slice(0, index + 1).join('/')}`; return last ? ( {breadcrumbNameMap[to]} ) : ( {breadcrumbNameMap[to]} ); })} ); } export default function RouterBreadcrumbs() { const [open, setOpen] = React.useState(true); const handleClick = () => { setOpen((prevOpen) => !prevOpen); }; return ( } /> ); }