Debian Codegraph @

node/@patternfly/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx

raw
1 import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy';
2 import { css } from '@patternfly/react-styles';
3 import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
4 import { Button } from '../Button';
5
6 export interface ClipboardCopyToggleProps extends Omit<
7 React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>,
8 'ref'
9 > {
10 onClick: (event: React.MouseEvent) => void;
11 id: string;
12 contentId: string;
13 isExpanded?: boolean;
14 className?: string;
15 }
16
17 export const ClipboardCopyToggle: React.FunctionComponent<ClipboardCopyToggleProps> = ({
18 onClick,
19 id,
20 contentId,
21 isExpanded = false,
22 ...props
23 }: ClipboardCopyToggleProps) => (
24 <Button
25 type="button"
26 variant="control"
27 onClick={onClick}
28 id={id}
29 aria-controls={isExpanded ? contentId : undefined}
30 aria-expanded={isExpanded}
31 {...props}
32 icon={
33 <div className={css(styles.clipboardCopyToggleIcon)}>
34 <RhMicronsCaretDownIcon />
35 </div>
36 }
37 />
38 );
39 ClipboardCopyToggle.displayName = 'ClipboardCopyToggle';