| 1 |
import styles from '@patternfly/react-styles/css/layouts/Split/split'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
|
| 4 |
export interface SplitItemProps extends React.HTMLProps<HTMLDivElement> { |
| 5 |
/** Flag indicating if this split layout item should fill the available horizontal space. */ |
| 6 |
isFilled?: boolean; |
| 7 |
/** Content rendered inside the split layout item. */ |
| 8 |
children?: React.ReactNode; |
| 9 |
/** Additional classes added to the split layout item. */ |
| 10 |
className?: string; |
| 11 |
/** Sets the base component to render. Defaults to div. */ |
| 12 |
component?: React.ReactNode; |
| 13 |
} |
| 14 |
|
| 15 |
export const SplitItem: React.FunctionComponent<SplitItemProps> = ({ |
| 16 |
isFilled = false, |
| 17 |
className = '', |
| 18 |
children = null, |
| 19 |
component = 'div', |
| 20 |
...props |
| 21 |
}: SplitItemProps) => { |
| 22 |
const Component = component as any; |
| 23 |
return ( |
| 24 |
<Component {...props} className={css(styles.splitItem, isFilled && styles.modifiers.fill, className)}> |
| 25 |
{children} |
| 26 |
</Component> |
| 27 |
); |
| 28 |
}; |
| 29 |
SplitItem.displayName = 'SplitItem'; |