| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/DataList/data-list'; |
| 3 |
|
| 4 |
export interface DataListContentProps extends React.HTMLProps<HTMLElement> { |
| 5 |
/** Content rendered inside the DataList item */ |
| 6 |
children?: React.ReactNode; |
| 7 |
/** Additional classes added to the DataList cell */ |
| 8 |
className?: string; |
| 9 |
/** Identify the DataListContent item */ |
| 10 |
id?: string; |
| 11 |
/** Id for the row */ |
| 12 |
rowid?: string; |
| 13 |
/** Flag to show if the expanded content of the DataList item is visible */ |
| 14 |
isHidden?: boolean; |
| 15 |
/** Flag to remove padding from the expandable content */ |
| 16 |
hasNoPadding?: boolean; |
| 17 |
/** Adds accessible text to the DataList toggle */ |
| 18 |
'aria-label': string; |
| 19 |
} |
| 20 |
|
| 21 |
export const DataListContent: React.FunctionComponent<DataListContentProps> = ({ |
| 22 |
className = '', |
| 23 |
children = null, |
| 24 |
id = '', |
| 25 |
isHidden = false, |
| 26 |
'aria-label': ariaLabel, |
| 27 |
hasNoPadding = false, |
| 28 |
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 29 |
rowid = '', |
| 30 |
...props |
| 31 |
}: DataListContentProps) => ( |
| 32 |
<section |
| 33 |
id={id} |
| 34 |
className={css(styles.dataListExpandableContent, className)} |
| 35 |
hidden={isHidden} |
| 36 |
aria-label={ariaLabel} |
| 37 |
{...props} |
| 38 |
> |
| 39 |
<div className={css(styles.dataListExpandableContentBody, hasNoPadding && styles.modifiers.noPadding)}> |
| 40 |
{children} |
| 41 |
</div> |
| 42 |
</section> |
| 43 |
); |
| 44 |
DataListContent.displayName = 'DataListContent'; |