Debian Codegraph @

node/@patternfly/react-core/src/components/Sidebar/Sidebar.tsx

raw
1 import { css } from '@patternfly/react-styles';
2 import styles from '@patternfly/react-styles/css/components/Sidebar/sidebar';
3
4 export enum SidebarBackgroundVariant {
5 default = 'default',
6 secondary = 'secondary'
7 }
8
9 export interface SidebarProps extends React.HTMLProps<HTMLDivElement> {
10 children?: React.ReactNode;
11 /** Indicates the direction of the layout. Default orientation is stack on small screens, and split on medium screens and above. */
12 orientation?: 'stack' | 'split';
13 /** Indicates that the panel is displayed to the right of the content when the oritentation is split. */
14 isPanelRight?: boolean;
15 /** Adds space between the panel and content. */
16 hasGutter?: boolean;
17 /** Removes the background color. */
18 hasNoBackground?: boolean;
19 /** Adds a border between the panel and content. */
20 hasBorder?: boolean;
21 }
22
23 export const Sidebar: React.FunctionComponent<SidebarProps> = ({
24 className,
25 children,
26 orientation,
27 isPanelRight = false,
28 hasGutter,
29 hasNoBackground,
30 hasBorder,
31 ...props
32 }: SidebarProps) => (
33 <div
34 className={css(
35 styles.sidebar,
36 hasGutter && styles.modifiers.gutter,
37 hasNoBackground && styles.modifiers.noBackground,
38 isPanelRight && styles.modifiers.panelRight,
39 styles.modifiers[orientation],
40 className
41 )}
42 {...props}
43 >
44 <div className={css(styles.sidebarMain, hasBorder && styles.modifiers.border)}>{children}</div>
45 </div>
46 );
47 Sidebar.displayName = 'Sidebar';