| 1 |
import styles from '@patternfly/react-styles/css/components/Popover/popover'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
|
| 4 |
export const PopoverPosition = { |
| 5 |
top: 'top', |
| 6 |
bottom: 'bottom', |
| 7 |
left: 'left', |
| 8 |
right: 'right' |
| 9 |
}; |
| 10 |
|
| 11 |
export const PopoverDialog: React.FunctionComponent<PopoverDialogProps> = ({ |
| 12 |
position = 'top', |
| 13 |
children = null, |
| 14 |
className = null, |
| 15 |
...props |
| 16 |
}: PopoverDialogProps) => ( |
| 17 |
<div |
| 18 |
className={css(styles.popover, styles.modifiers[position] || styles.modifiers.top, className)} |
| 19 |
role="dialog" |
| 20 |
aria-modal="true" |
| 21 |
{...props} |
| 22 |
> |
| 23 |
{children} |
| 24 |
</div> |
| 25 |
); |
| 26 |
PopoverDialog.displayName = 'PopoverDialog'; |
| 27 |
|
| 28 |
export interface PopoverDialogProps extends React.HTMLProps<HTMLDivElement> { |
| 29 |
/** PopoverDialog position */ |
| 30 |
position?: 'top' | 'bottom' | 'left' | 'right'; |
| 31 |
/** PopoverDialog additional class */ |
| 32 |
className?: string; |
| 33 |
/** PopoverDialog body */ |
| 34 |
children: React.ReactNode; |
| 35 |
} |