| 1 |
import { Fragment } from 'react'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box'; |
| 4 |
|
| 5 |
export interface ModalBoxHeaderProps { |
| 6 |
/** Content rendered inside the modal box header. */ |
| 7 |
children?: React.ReactNode; |
| 8 |
/** Additional classes added to the modal box header. */ |
| 9 |
className?: string; |
| 10 |
/** Optional help section for the modal box header. */ |
| 11 |
help?: React.ReactNode; |
| 12 |
} |
| 13 |
|
| 14 |
export const ModalBoxHeader: React.FunctionComponent<ModalBoxHeaderProps> = ({ |
| 15 |
children = null, |
| 16 |
className = '', |
| 17 |
help = null, |
| 18 |
...props |
| 19 |
}: ModalBoxHeaderProps) => ( |
| 20 |
<header className={css(styles.modalBoxHeader, help && styles.modifiers.help, className)} {...props}> |
| 21 |
{help && ( |
| 22 |
<Fragment> |
| 23 |
<div className={css(styles.modalBoxHeaderMain)}>{children}</div> |
| 24 |
<div className={`${styles.modalBoxHeader}-help`}>{help}</div> |
| 25 |
</Fragment> |
| 26 |
)} |
| 27 |
{!help && children} |
| 28 |
</header> |
| 29 |
); |
| 30 |
ModalBoxHeader.displayName = 'ModalBoxHeader'; |