UNPKG

916 BJavaScriptView Raw
1import React from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4import { mapToCssModules, tagPropType } from './utils';
5
6const propTypes = {
7 children: PropTypes.node,
8 /** To add custom class */
9 className: PropTypes.string,
10 /** Change existing base class name with a new class name */
11 cssModule: PropTypes.object,
12 innerRef: PropTypes.oneOfType([
13 PropTypes.object,
14 PropTypes.string,
15 PropTypes.func,
16 ]),
17 /** Set a custom element for this component */
18 tag: tagPropType,
19};
20
21function AccordionItem(props) {
22 const {
23 className,
24 cssModule,
25 tag: Tag = 'div',
26 innerRef,
27 ...attributes
28 } = props;
29 const classes = mapToCssModules(
30 classNames(className, 'accordion-item'),
31 cssModule,
32 );
33
34 return <Tag {...attributes} className={classes} ref={innerRef} />;
35}
36
37AccordionItem.propTypes = propTypes;
38
39export default AccordionItem;
40
\No newline at end of file