| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/Popover/popover'; |
| 3 |
import { Button } from '../Button'; |
| 4 |
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon'; |
| 5 |
|
| 6 |
export const PopoverCloseButton: React.FunctionComponent<PopoverCloseButtonProps> = ({ |
| 7 |
onClose = () => undefined as void, |
| 8 |
...props |
| 9 |
}: PopoverCloseButtonProps) => ( |
| 10 |
<div className={css(styles.popoverClose)}> |
| 11 |
<Button |
| 12 |
onClick={onClose} |
| 13 |
variant="plain" |
| 14 |
aria-label |
| 15 |
{...props} |
| 16 |
style={{ pointerEvents: 'auto' }} |
| 17 |
icon={<RhMicronsCloseIcon />} |
| 18 |
/> |
| 19 |
</div> |
| 20 |
); |
| 21 |
|
| 22 |
PopoverCloseButton.displayName = 'PopoverCloseButton'; |
| 23 |
|
| 24 |
export interface PopoverCloseButtonProps { |
| 25 |
/** PopoverCloseButton onClose function */ |
| 26 |
onClose?: (event: any) => void; |
| 27 |
/** Aria label for the Close button */ |
| 28 |
'aria-label': string; |
| 29 |
} |