forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClipboardCopyToggle.tsx
More file actions
39 lines (37 loc) · 1.11 KB
/
ClipboardCopyToggle.tsx
File metadata and controls
39 lines (37 loc) · 1.11 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy';
import { css } from '@patternfly/react-styles';
import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
import { Button } from '../Button';
export interface ClipboardCopyToggleProps extends Omit<
React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>,
'ref'
> {
onClick: (event: React.MouseEvent) => void;
id: string;
contentId: string;
isExpanded?: boolean;
className?: string;
}
export const ClipboardCopyToggle: React.FunctionComponent<ClipboardCopyToggleProps> = ({
onClick,
id,
contentId,
isExpanded = false,
...props
}: ClipboardCopyToggleProps) => (
<Button
type="button"
variant="control"
onClick={onClick}
id={id}
aria-controls={isExpanded ? contentId : undefined}
aria-expanded={isExpanded}
{...props}
icon={
<div className={css(styles.clipboardCopyToggleIcon)}>
<RhMicronsCaretDownIcon />
</div>
}
/>
);
ClipboardCopyToggle.displayName = 'ClipboardCopyToggle';