UNPKG

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