UNPKG

@carbon/react

Version:

React components for the Carbon Design System

64 lines (60 loc) 1.74 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import PropTypes from 'prop-types'; import React from 'react'; import cx from 'classnames'; import { usePrefix } from '../../internal/usePrefix.js'; function Item() { const prefix = usePrefix(); return /*#__PURE__*/React.createElement("div", { className: `${prefix}--breadcrumb-item` }, /*#__PURE__*/React.createElement("span", { className: `${prefix}--link` }, "\xA0")); } function BreadcrumbSkeleton({ className, items = 3, noTrailingSlash, size, ...rest }) { const prefix = usePrefix(); const classes = cx({ [`${prefix}--breadcrumb`]: true, [`${prefix}--skeleton`]: true, [`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash, [`${prefix}--breadcrumb--sm`]: size === 'sm' }, className); return /*#__PURE__*/React.createElement("div", _extends({ className: classes }, rest), Array.from({ length: items }, (_, i) => /*#__PURE__*/React.createElement(Item, { key: i }))); } BreadcrumbSkeleton.propTypes = { /** * Specify an optional className to add. */ className: PropTypes.string, /** * Specify the number of items */ items: PropTypes.number, /** * Optional prop to omit the trailing slash for the breadcrumbs */ noTrailingSlash: PropTypes.bool, /** * Specify the size of the Breadcrumb. Currently supports the following: `sm` & `md` (default: 'md') */ size: PropTypes.oneOf(['sm', 'md']) }; export { BreadcrumbSkeleton, BreadcrumbSkeleton as default };