@talend/react-bootstrap
Version:
Bootstrap 3 components built with React
60 lines (59 loc) • 1.34 kB
JavaScript
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import SafeAnchor from './SafeAnchor';
import { jsx as _jsx } from "react/jsx-runtime";
const propTypes = {
/**
* If set to true, renders `span` instead of `a`
*/
active: PropTypes.bool,
/**
* `href` attribute for the inner `a` element
*/
href: PropTypes.string,
/**
* `title` attribute for the inner `a` element
*/
title: PropTypes.node,
/**
* `target` attribute for the inner `a` element
*/
target: PropTypes.string
};
const defaultProps = {
active: false
};
class BreadcrumbItem extends React.Component {
render() {
const {
active,
href,
title,
target,
className,
...props
} = this.props;
// Don't try to render these props on non-active <span>.
const linkProps = {
href,
title,
target
};
return /*#__PURE__*/_jsx("li", {
className: classNames(className, {
active
}),
children: active ? /*#__PURE__*/_jsx("span", {
...props
}) : /*#__PURE__*/_jsx(SafeAnchor, {
...props,
...linkProps
})
});
}
}
BreadcrumbItem.propTypes = propTypes;
BreadcrumbItem.defaultProps = defaultProps;
export default BreadcrumbItem;
//# sourceMappingURL=BreadcrumbItem.js.map