import { Children, cloneElement, isValidElement } from 'react'; import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/DataList/data-list'; import { DataListWrapModifier } from './DataList'; export interface DataListItemRowProps extends Omit, 'children'> { /** Content rendered inside the DataListItemRow */ children: React.ReactNode; /** Additional classes added to the DataListItemRow */ className?: string; /** Id for the row item */ rowid?: string; /** Determines which wrapping modifier to apply to the DataListItemRow */ wrapModifier?: DataListWrapModifier | 'nowrap' | 'truncate' | 'breakWord'; } export const DataListItemRow: React.FunctionComponent = ({ children, className = '', rowid = '', wrapModifier = null, ...props }: DataListItemRowProps) => (
{Children.map( children, (child) => isValidElement(child) && cloneElement(child as React.ReactElement, { rowid }) )}
); DataListItemRow.displayName = 'DataListItemRow';