You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.5 KiB
43 lines
1.5 KiB
import React from 'react';
|
|
import { Breadcrumb } from 'antd';
|
|
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';
|
|
import { Link } from 'react-router-dom';
|
|
|
|
const Breadcrumbs = (props) => {
|
|
const excludePaths = ['/'];
|
|
const { routes } = props;
|
|
|
|
const Bread = withBreadcrumbs(routes, { excludePaths })(({ breadcrumbs }) => {
|
|
return (
|
|
<Breadcrumb separator="/" style={{ height: 25 }}>
|
|
{
|
|
breadcrumbs.map((bc, index) => {
|
|
return (
|
|
<Breadcrumb.Item key={index}>
|
|
{
|
|
bc.component ?
|
|
<Link
|
|
to={{
|
|
pathname: bc.match.url,
|
|
state: bc.match.params ? bc.match.params : {},
|
|
query: bc.location.query ? bc.location.query : {},
|
|
}}
|
|
>
|
|
{bc.breadcrumb}
|
|
</Link> :
|
|
bc.breadcrumb
|
|
}
|
|
</Breadcrumb.Item>
|
|
)
|
|
})
|
|
}
|
|
</Breadcrumb>
|
|
)
|
|
});
|
|
|
|
return (
|
|
<Bread />
|
|
);
|
|
}
|
|
|
|
export default Breadcrumbs;
|
|
|