@carbon/react
Version:
React components for the Carbon Design System
50 lines (44 loc) • 1.44 kB
JavaScript
/**
* 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.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var cx = require('classnames');
var PropTypes = require('prop-types');
var React = require('react');
var usePrefix = require('../../internal/usePrefix.js');
const SideNavDetails = ({
children,
className: customClassName,
title,
...rest
}) => {
const prefix = usePrefix.usePrefix();
const className = cx(`${prefix}--side-nav__details`, customClassName);
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
className: className
}, rest), /*#__PURE__*/React.createElement("h2", {
className: `${prefix}--side-nav__title`,
title: title
}, title), children);
};
SideNavDetails.propTypes = {
/**
* Provide optional children to render in `SideNavDetails`. Useful for
* rendering the `SideNavSwitcher` component.
*/
children: PropTypes.node,
/**
* Optionally provide a custom class to apply to the underlying `<li>` node
*/
className: PropTypes.string,
/**
* Provide the text that will be rendered as the title in the component
*/
title: PropTypes.string.isRequired
};
exports.default = SideNavDetails;