@antdp/basic-layouts
Version:
33 lines • 975 B
JavaScript
import React, { useMemo } from "react";
import { Breadcrumb } from "antd";
import { useLocation, Link } from 'react-router-dom';
import { useLayouts } from "./../hooks";
import { LayoutModel } from "../interface";
import { jsx as _jsx } from "react/jsx-runtime";
var Breadcrumbs = () => {
var location = useLocation();
var {
HandleMenu,
layout
} = useLayouts();
var breadcrumbMenu = useMemo(() => {
return HandleMenu.getBreadcrumb(location.pathname).map((item, index) => {
var child = item.name;
if (item.side && item.path && layout === LayoutModel.SLIDER) {
child = /*#__PURE__*/_jsx(Link, {
to: item.path,
children: item.name
});
}
return {
title: child,
key: index
};
});
}, [location.pathname, layout]);
return /*#__PURE__*/_jsx(Breadcrumb, {
className: "antdp-basic-layouts-header-breadcrumb",
items: breadcrumbMenu
});
};
export default Breadcrumbs;