MCPcopy Create free account
hub / github.com/dailydotdev/apps / CopyLinkButton

Function CopyLinkButton

packages/shared/src/components/share/CopyLinkButton.tsx:23–52  ·  view source on GitHub ↗
({
  shareProps,
  origin,
  className,
  size = ButtonSize.Small,
  variant = ButtonVariant.Float,
}: CopyLinkButtonProps)

Source from the content-addressed store, hash-verified

21const COPIED_LABEL = 'Copied!';
22
23export 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};

Callers

nothing calls this directly

Calls 1

useShareOrCopyLinkFunction · 0.90

Tested by

no test coverage detected