| 1 |
import styles from '@patternfly/react-styles/css/components/Card/card'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
|
| 4 |
import type { JSX } from 'react'; |
| 5 |
|
| 6 |
export interface CardBodyProps extends React.HTMLProps<HTMLDivElement> { |
| 7 |
/** Content rendered inside the Card Body */ |
| 8 |
children?: React.ReactNode; |
| 9 |
/** Additional classes added to the Card Body */ |
| 10 |
className?: string; |
| 11 |
/** Sets the base component to render. defaults to div */ |
| 12 |
component?: keyof JSX.IntrinsicElements; |
| 13 |
/** Enables the body Content to fill the height of the card */ |
| 14 |
isFilled?: boolean; |
| 15 |
} |
| 16 |
|
| 17 |
export const CardBody: React.FunctionComponent<CardBodyProps> = ({ |
| 18 |
children, |
| 19 |
className, |
| 20 |
component = 'div', |
| 21 |
isFilled = true, |
| 22 |
...props |
| 23 |
}: CardBodyProps) => { |
| 24 |
const Component = component as any; |
| 25 |
return ( |
| 26 |
<Component className={css(styles.cardBody, !isFilled && styles.modifiers.noFill, className)} {...props}> |
| 27 |
{children} |
| 28 |
</Component> |
| 29 |
); |
| 30 |
}; |
| 31 |
CardBody.displayName = 'CardBody'; |