forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawerCloseButton.tsx
More file actions
25 lines (23 loc) · 1.04 KB
/
DrawerCloseButton.tsx
File metadata and controls
25 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
import { css } from '@patternfly/react-styles';
import { Button } from '../Button';
import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
export interface DrawerCloseButtonProps extends React.HTMLProps<HTMLDivElement> {
/** Additional classes added to the drawer close button outer <div>. */
className?: string;
/** A callback for when the close button is clicked */
onClose?: () => void;
/** Accessible label for the drawer close button */
'aria-label'?: string;
}
export const DrawerCloseButton: React.FunctionComponent<DrawerCloseButtonProps> = ({
className = '',
onClose = () => undefined as any,
'aria-label': ariaLabel = 'Close drawer panel',
...props
}: DrawerCloseButtonProps) => (
<div className={css(styles.drawerClose, className)} {...props}>
<Button variant="plain" onClick={onClose} aria-label={ariaLabel} icon={<RhMicronsCloseIcon />} />
</div>
);
DrawerCloseButton.displayName = 'DrawerCloseButton';