UNPKG

@intility/bifrost-react

Version:

React library for Intility's design system, Bifrost.

26 lines (25 loc) 856 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from "react"; import classNames from "classnames"; import Icon from "../Icon/Icon.js"; import hasTruthyChildren from "../../utils/hasTruthyChildren.js"; /** * Item for Nav component */ const NavItem = /*#__PURE__*/ forwardRef(({ children, icon, className, ...props }, ref)=>{ return /*#__PURE__*/ _jsxs("div", { ...props, className: classNames("bf-nav-item bf-break-word", className, { "bf-nav-item-icon-only": icon && !hasTruthyChildren(children) }), ref: ref, children: [ icon && /*#__PURE__*/ _jsx(Icon, { icon: icon, className: "bf-nav-item-icon" }), children ] }); }); NavItem.displayName = "Nav.Item"; export default NavItem;