| 1 |
import styles from '@patternfly/react-styles/css/components/Drawer/drawer'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
import { DrawerColorVariant } from './Drawer'; |
| 4 |
|
| 5 |
export interface DrawerSectionProps extends React.HTMLProps<HTMLDivElement> { |
| 6 |
/** Additional classes added to the drawer section. */ |
| 7 |
className?: string; |
| 8 |
/** Content to be rendered in the drawer section. */ |
| 9 |
children?: React.ReactNode; |
| 10 |
/** |
| 11 |
* Color variant of the background of the drawer section. |
| 12 |
* The `no-background` value is deprecated; use the `isPlain` prop instead. |
| 13 |
*/ |
| 14 |
colorVariant?: DrawerColorVariant | 'no-background' | 'default' | 'secondary'; |
| 15 |
/** @beta Flag indicating that the drawer section should use plain styles. */ |
| 16 |
isPlain?: boolean; |
| 17 |
} |
| 18 |
|
| 19 |
export const DrawerSection: React.FunctionComponent<DrawerSectionProps> = ({ |
| 20 |
className = '', |
| 21 |
children, |
| 22 |
colorVariant = DrawerColorVariant.default, |
| 23 |
isPlain = false, |
| 24 |
...props |
| 25 |
}: DrawerSectionProps) => ( |
| 26 |
<div |
| 27 |
className={css( |
| 28 |
styles.drawerSection, |
| 29 |
isPlain && styles.modifiers.plain, |
| 30 |
colorVariant === DrawerColorVariant.noBackground && styles.modifiers.noBackground, |
| 31 |
colorVariant === DrawerColorVariant.secondary && styles.modifiers.secondary, |
| 32 |
className |
| 33 |
)} |
| 34 |
{...props} |
| 35 |
> |
| 36 |
{children} |
| 37 |
</div> |
| 38 |
); |
| 39 |
DrawerSection.displayName = 'DrawerSection'; |