| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/Sidebar/sidebar'; |
| 3 |
|
| 4 |
export interface SidebarContentProps extends React.HTMLProps<HTMLDivElement> { |
| 5 |
children: React.ReactNode; |
| 6 |
/** Removes the background color. */ |
| 7 |
hasNoBackground?: boolean; |
| 8 |
/** Adds padding to the content. */ |
| 9 |
hasPadding?: boolean; |
| 10 |
/** Variant of the sidebar content background. */ |
| 11 |
backgroundVariant?: 'default' | 'secondary'; |
| 12 |
} |
| 13 |
|
| 14 |
export const SidebarContent: React.FunctionComponent<SidebarContentProps> = ({ |
| 15 |
className, |
| 16 |
children, |
| 17 |
hasNoBackground, |
| 18 |
hasPadding, |
| 19 |
backgroundVariant = 'default', |
| 20 |
...props |
| 21 |
}: SidebarContentProps) => ( |
| 22 |
<div |
| 23 |
className={css( |
| 24 |
styles.sidebarContent, |
| 25 |
hasNoBackground && styles.modifiers.noBackground, |
| 26 |
hasPadding && styles.modifiers.padding, |
| 27 |
backgroundVariant !== 'default' && styles.modifiers[backgroundVariant], |
| 28 |
className |
| 29 |
)} |
| 30 |
{...props} |
| 31 |
> |
| 32 |
{children} |
| 33 |
</div> |
| 34 |
); |
| 35 |
SidebarContent.displayName = 'SidebarContent'; |