| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import * as React from 'react'; | ||
| import styles from '@patternfly/patternfly/components/OptionsMenu/options-menu.css'; | ||
| import { css, getModifier } from '@patternfly/react-styles'; | ||
|
|
||
| export enum OptionsMenuPosition { | ||
| right = 'right', | ||
| left = 'left' | ||
| } | ||
|
|
||
| export enum OptionsMenuDirection { | ||
| up = 'up', | ||
| down = 'down' | ||
| } | ||
|
|
||
| export interface OptionsMenuProps extends React.HTMLProps<HTMLDivElement>{ | ||
|
Comment thread
redallen marked this conversation as resolved.
|
||
| /** Classes applied to root element of the Options menu */ | ||
| className?: string; | ||
| /** Id of the root element of the Options menu */ | ||
| id: string; | ||
| /** Array of OptionsMenuItem and/or OptionMenuItemGroup nodes that will be rendered in the Options menu list */ | ||
| menuItems: React.ReactNode[]; | ||
| /** Either an OptionsMenuToggle or an OptionsMenuToggleWithText to use to toggle the Options menu */ | ||
| toggle: React.ReactElement; | ||
|
Comment thread
dlabaj marked this conversation as resolved.
|
||
| /** Flag to indicate the toggle has no border or background */ | ||
| isPlain?: boolean; | ||
| /** Flag to indicate if menu is open */ | ||
| isOpen?: boolean; | ||
| /** Provides an accessible name for the Options menu */ | ||
| ariaLabelMenu?: string; | ||
| /** Indicates where menu will be aligned horizontally */ | ||
| position?: 'right' | 'left'; | ||
| /** Menu will open up or open down from the Options menu toggle */ | ||
| direction?: 'up' | 'down'; | ||
| } | ||
|
|
||
| export const OptionsMenu: React.FunctionComponent<OptionsMenuProps> = ({ | ||
| className = '', | ||
| isOpen = false, | ||
| isPlain = false, | ||
| ariaLabelMenu = '', | ||
| direction = OptionsMenuDirection.down, | ||
| position = OptionsMenuPosition.left, | ||
| id, | ||
| menuItems, | ||
| toggle, | ||
| ...props | ||
| }: OptionsMenuProps) => ( | ||
| <div id={id} | ||
| className={ | ||
| css(styles.optionsMenu, | ||
| direction === OptionsMenuDirection.up && getModifier(styles, 'top'), | ||
| position === OptionsMenuPosition.right && getModifier(styles, 'align-right'), | ||
| isOpen && getModifier(styles, 'expanded'), | ||
| className)} | ||
| {...props}> | ||
| {React.Children.map(toggle, oneToggle => | ||
| React.cloneElement(oneToggle, { | ||
| parentId: id, | ||
| isOpen, | ||
| isPlain, | ||
| }))} | ||
| {isOpen && | ||
| <ul className={css(styles.optionsMenuMenu, | ||
| position === OptionsMenuPosition.right && getModifier(styles, 'align-right'))} | ||
| {...ariaLabelMenu ? {'aria-label': ariaLabelMenu} : {'aria-labelledby': `${id}-toggle`}}> | ||
| {menuItems} | ||
| </ul>} | ||
| </div> | ||
| ); | ||
This file was deleted.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.