saagie-ui
Version:
Saagie UI from Saagie Design System
50 lines (43 loc) • 1.04 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
const propTypes = {
children: PropTypes.node.isRequired,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
tag: PropTypes.elementType,
defaultClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
className: PropTypes.string,
title: PropTypes.node.isRequired,
};
const defaultProps = {
tag: 'div',
defaultClassName: 'sui-o-secondary-nav__category',
className: '',
};
export const SecondaryNavGroup = (props) => {
const {
children,
tag: Tag,
defaultClassName,
className,
title,
...attributes
} = props;
const classes = classnames(
defaultClassName,
className
);
return (
<>
<Tag className={classes} {...attributes}>
{title}
</Tag>
{children}
</>
);
};
SecondaryNavGroup.propTypes = propTypes;
SecondaryNavGroup.defaultProps = defaultProps;