Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Copy tick interaction

Steven Tey1e67fc343c4e
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsx
index 9104046362..e75e662374 100644
--- a/components/stats/toggle.tsx
+++ b/components/stats/toggle.tsx
@@ -163,6 +163,7 @@ const SharePopover = ({ domain }: { domain: string }) => {
},
);
};
+ const [copied, setCopied] = useState(false);
return (
<Popover
@@ -215,10 +216,16 @@ const SharePopover = ({ domain }: { domain: string }) => {
navigator.clipboard.writeText(
`https://${domain}/stats/${key}`,
);
+ setCopied(true);
toast.success("Copied to clipboard");
+ setTimeout(() => setCopied(false), 3000);
}}
>
- <Copy className="h-4 w-4 text-gray-500" />
+ {copied ? (
+ <Tick className="h-4 w-4 text-gray-500" />
+ ) : (
+ <Copy className="h-4 w-4 text-gray-500" />
+ )}
</button>
</div>
</div>