components.breadcrumbs.DetailBreadcrumbs.tsx Maven / Gradle / Ivy
import Breadcrumbs from 'components/breadcrumbs/Breadcrumbs';
import { createDetailCrumbKey } from 'components/view/utils/view';
import Settings from 'helpers/settings';
import { useParams } from 'react-router';
import { Box } from '@mui/material';
import { Crumb } from './Crumb';
const DetailBreadcrumbs = ({label}: {label: string}) => {
const {detail, id} = useParams()
const variable = createDetailCrumbKey(detail,id)
const crumbs = Settings.session.read(variable, [])
if (crumbs.length > 0) {
crumbs[crumbs.length -1].label = label
} else {
crumbs.push({label: label})
}
return (
)
}
const Crumbs = ({crumbs}: {crumbs: Crumb[]}) =>
crumbs.length > 0 ? : null
export default DetailBreadcrumbs