({
shareProps,
origin,
className,
size = ButtonSize.Small,
variant = ButtonVariant.Float,
}: CopyLinkButtonProps)
| 21 | const COPIED_LABEL = 'Copied!'; |
| 22 | |
| 23 | export const CopyLinkButton = ({ |
| 24 | shareProps, |
| 25 | origin, |
| 26 | className, |
| 27 | size = ButtonSize.Small, |
| 28 | variant = ButtonVariant.Float, |
| 29 | }: CopyLinkButtonProps): ReactElement => { |
| 30 | // Stays false on the native-share path, where the OS sheet is the feedback. |
| 31 | const [copied, onShareOrCopyLink] = useShareOrCopyLink({ |
| 32 | ...shareProps, |
| 33 | logObject: (provider) => ({ |
| 34 | ...shareProps.logObject(provider), |
| 35 | extra: JSON.stringify({ provider, origin }), |
| 36 | }), |
| 37 | }); |
| 38 | |
| 39 | return ( |
| 40 | <Tooltip content={copied ? COPIED_LABEL : LABEL}> |
| 41 | <Button |
| 42 | aria-label={LABEL} |
| 43 | className={className} |
| 44 | icon={<CopyStateIcon copied={copied} icon={LinkIcon} />} |
| 45 | onClick={() => onShareOrCopyLink()} |
| 46 | size={size} |
| 47 | type="button" |
| 48 | variant={variant} |
| 49 | /> |
| 50 | </Tooltip> |
| 51 | ); |
| 52 | }; |
nothing calls this directly
no test coverage detected