Debian Codegraph @

node/@patternfly/react-core/src/components/OverflowMenu/OverflowMenuItem.tsx

raw
1 import { css } from '@patternfly/react-styles';
2 import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflow-menu';
3 import { OverflowMenuContext } from './OverflowMenuContext';
4
5 export interface OverflowMenuItemProps extends React.HTMLProps<HTMLDivElement> {
6 /** Any elements that can be rendered in the menu */
7 children?: any;
8 /** Additional classes added to the OverflowMenuItem */
9 className?: string;
10 /** Modifies the overflow menu item visibility */
11 isPersistent?: boolean;
12 }
13
14 export const OverflowMenuItem: React.FunctionComponent<OverflowMenuItemProps> = ({
15 className,
16 children,
17 isPersistent = false
18 }: OverflowMenuItemProps) => (
19 <OverflowMenuContext.Consumer>
20 {(value) =>
21 (isPersistent || !value.isBelowBreakpoint) && (
22 <div className={css(styles.overflowMenuItem, className)}> {children} </div>
23 )
24 }
25 </OverflowMenuContext.Consumer>
26 );
27 OverflowMenuItem.displayName = 'OverflowMenuItem';