-
Notifications
You must be signed in to change notification settings - Fork 349
/
CardBody.js
36 lines (31 loc) · 1.09 KB
/
CardBody.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly/components/Card/card.css';
import { componentShape } from '../../helpers/componentShape';
const propTypes = {
/** content rendered inside the Card Body */
children: PropTypes.any,
/** additional classes added to the Card Body */
className: PropTypes.string,
/** Sets the base component to render. defaults to div */
component: componentShape,
/** Enables the body Content to fill the height of the card */
isFilled: PropTypes.bool,
/** Additional props are spread to the container component */
'': PropTypes.any
};
const defaultProps = {
children: null,
className: '',
component: 'div',
isFilled: true
};
const CardBody = ({ children, className, component: Component, isFilled, ...props }) => (
<Component className={css(styles.cardBody, !isFilled && styles.modifiers.noFill, className)} {...props}>
{children}
</Component>
);
CardBody.propTypes = propTypes;
CardBody.defaultProps = defaultProps;
export default CardBody;