diff --git a/src/pages/Contributors/Contributors.tsx b/src/pages/Contributors/Contributors.tsx index d4fee52c..a0b43e71 100644 --- a/src/pages/Contributors/Contributors.tsx +++ b/src/pages/Contributors/Contributors.tsx @@ -11,7 +11,7 @@ import { CircularProgress, Alert, } from "@mui/material"; -import { FaGithub } from "react-icons/fa"; +import { FaGithub, FaCopy, FaCheck } from "react-icons/fa"; import { Link } from "react-router-dom"; import axios from "axios"; import { GITHUB_REPO_CONTRIBUTORS_URL } from "../../utils/constants"; @@ -28,7 +28,16 @@ const ContributorsPage = () => { const [contributors, setContributors] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); +const [copiedId, setCopiedId] = useState(null); +const handleCopy = async (contributor: Contributor) => { + await navigator.clipboard.writeText(contributor.html_url); + setCopiedId(contributor.id); + + setTimeout(() => { + setCopiedId(null); + }, 2000); +}; // Fetch contributors from GitHub API useEffect(() => { const fetchContributors = async () => { @@ -114,24 +123,39 @@ const ContributorsPage = () => { - - - + + + + + ))}