UNPKG

norma-library

Version:

Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.

22 lines 1.18 kB
import React, { useMemo } from 'react'; import * as S from "./styles"; import { Icons } from '../Icons'; import { Home } from '@mui/icons-material'; var Breadcrumb = function (_a) { var items = _a.items, onHomeClick = _a.onHomeClick, onPathClick = _a.onPathClick; var listItems = useMemo(function () { return items.map(function (item, index, self) { var showIcon = self.length > index + 1; var isFixedIcon = items[0] === item; return (React.createElement("div", { className: 'content', key: index, onClick: function (event) { return items[0] === item ? onHomeClick(event) : onPathClick(item, event); } }, isFixedIcon && React.createElement(Icons, { icon: Home }), !isFixedIcon && item.icon && React.createElement(Icons, { icon: item.icon, color: 'inherit' }), React.createElement(S.Item, null, item.label), showIcon && React.createElement(S.Divisor, null, "/"))); }); }, [items]); return (React.createElement(S.Container, null, React.createElement(S.ListItems, null, listItems))); }; export default Breadcrumb; //# sourceMappingURL=index.js.map