UNPKG

@uiw/react-breadcrumb

Version:

Breadcrumb component

34 lines 1.33 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["prefixCls", "className", "tagName", "active", "separator"]; import React, { Fragment } from 'react'; import "./style/item.css"; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; var BreadcrumbItem = /*#__PURE__*/React.forwardRef((props, ref) => { var { prefixCls = 'w-breadcrumb', className, tagName: TagName = 'span', active, separator } = props, other = _objectWithoutPropertiesLoose(props, _excluded); var isElm = /*#__PURE__*/React.isValidElement(separator); var cls = [prefixCls + "-item", className, active ? 'active' : null, !separator ? 'no-separator' : null, isElm ? 'no-before' : null].filter(Boolean).join(' ').trim(); var otherProps = _extends({ className: cls }, other); if (!isElm) { otherProps['data-separator'] = separator; } return /*#__PURE__*/React.createElement(TagName, _extends({}, otherProps, { ref }), /*#__PURE__*/_jsxs(Fragment, { children: [isElm && /*#__PURE__*/_jsx("span", { className: prefixCls + "-separator", children: separator }), props.children] })); }); export default BreadcrumbItem;