main
Last change
on this file was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago |
add customer
|
-
Property mode
set to
100644
|
File size:
2.0 KB
|
Rev | Line | |
---|
[5d6f37a] | 1 | // @mui
|
---|
| 2 | import Box from '@mui/material/Box';
|
---|
| 3 | import Link from '@mui/material/Link';
|
---|
| 4 | import Stack from '@mui/material/Stack';
|
---|
| 5 | import Typography from '@mui/material/Typography';
|
---|
| 6 | import Breadcrumbs from '@mui/material/Breadcrumbs';
|
---|
| 7 | //
|
---|
| 8 | import { CustomBreadcrumbsProps } from './types';
|
---|
| 9 | import LinkItem from './link-item';
|
---|
| 10 |
|
---|
| 11 | // ----------------------------------------------------------------------
|
---|
| 12 |
|
---|
| 13 | export default function CustomBreadcrumbs({
|
---|
| 14 | links,
|
---|
| 15 | action,
|
---|
| 16 | heading,
|
---|
| 17 | moreLink,
|
---|
| 18 | activeLast,
|
---|
| 19 | sx,
|
---|
| 20 | ...other
|
---|
| 21 | }: CustomBreadcrumbsProps) {
|
---|
| 22 | const lastLink = links[links.length - 1].name;
|
---|
| 23 |
|
---|
| 24 | return (
|
---|
| 25 | <Box sx={{ ...sx }}>
|
---|
| 26 | <Stack direction="row" alignItems="center">
|
---|
| 27 | <Box sx={{ flexGrow: 1 }}>
|
---|
| 28 | {/* HEADING */}
|
---|
| 29 | {heading && (
|
---|
| 30 | <Typography variant="h4" gutterBottom>
|
---|
| 31 | {heading}
|
---|
| 32 | </Typography>
|
---|
| 33 | )}
|
---|
| 34 |
|
---|
| 35 | {/* BREADCRUMBS */}
|
---|
| 36 | {!!links.length && (
|
---|
| 37 | <Breadcrumbs separator={<Separator />} {...other}>
|
---|
| 38 | {links.map((link) => (
|
---|
| 39 | <LinkItem
|
---|
| 40 | key={link.name || ''}
|
---|
| 41 | link={link}
|
---|
| 42 | activeLast={activeLast}
|
---|
| 43 | disabled={link.name === lastLink}
|
---|
| 44 | />
|
---|
| 45 | ))}
|
---|
| 46 | </Breadcrumbs>
|
---|
| 47 | )}
|
---|
| 48 | </Box>
|
---|
| 49 |
|
---|
| 50 | {action && <Box sx={{ flexShrink: 0 }}> {action} </Box>}
|
---|
| 51 | </Stack>
|
---|
| 52 |
|
---|
| 53 | {/* MORE LINK */}
|
---|
| 54 | {!!moreLink && (
|
---|
| 55 | <Box sx={{ mt: 2 }}>
|
---|
| 56 | {moreLink.map((href) => (
|
---|
| 57 | <Link
|
---|
| 58 | key={href}
|
---|
| 59 | href={href}
|
---|
| 60 | variant="body2"
|
---|
| 61 | target="_blank"
|
---|
| 62 | rel="noopener"
|
---|
| 63 | sx={{ display: 'table' }}
|
---|
| 64 | >
|
---|
| 65 | {href}
|
---|
| 66 | </Link>
|
---|
| 67 | ))}
|
---|
| 68 | </Box>
|
---|
| 69 | )}
|
---|
| 70 | </Box>
|
---|
| 71 | );
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | // ----------------------------------------------------------------------
|
---|
| 75 |
|
---|
| 76 | function Separator() {
|
---|
| 77 | return (
|
---|
| 78 | <Box
|
---|
| 79 | component="span"
|
---|
| 80 | sx={{
|
---|
| 81 | width: 4,
|
---|
| 82 | height: 4,
|
---|
| 83 | borderRadius: '50%',
|
---|
| 84 | bgcolor: 'text.disabled',
|
---|
| 85 | }}
|
---|
| 86 | />
|
---|
| 87 | );
|
---|
| 88 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.