Merge branch 'main' into main

This commit is contained in:
Jeetul Samaiya 2025-09-15 19:30:18 +05:30 • committed by GitHub
commit f36c649bb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,29 @@
"use client";
import { useEffect, useState } from "react";
type UseCopyProps = {
timeout?: number;
};
function useCopy({ timeout = 500 }: UseCopyProps = {}) {
const [copied, setCopied] = useState(false);
useEffect(() => {
let timeoutId: NodeJS.Timeout;
if (copied) {
timeoutId = setTimeout(() => {
setCopied(false);
}, timeout);
}
return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
};
}, [copied]);
return { copied, setCopied };
}
export default useCopy;