diff --git a/src/pages/Contributors/Contributors.tsx b/src/pages/Contributors/Contributors.tsx index d4fee52c..56816ad1 100644 --- a/src/pages/Contributors/Contributors.tsx +++ b/src/pages/Contributors/Contributors.tsx @@ -1,4 +1,6 @@ import { useEffect, useState } from "react"; +import { TextField, InputAdornment } from "@mui/material"; +import { FaSearch } from "react-icons/fa"; import { Container, Grid, @@ -28,6 +30,7 @@ const ContributorsPage = () => { const [contributors, setContributors] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); + const [searchTerm, setSearchTerm] = useState(""); // Fetch contributors from GitHub API useEffect(() => { @@ -47,6 +50,10 @@ const ContributorsPage = () => { fetchContributors(); }, []); + const filteredContributors = contributors.filter((contributor) => + contributor.login.toLowerCase().includes(searchTerm.toLowerCase()), + ); + if (loading) { return ( @@ -65,74 +72,136 @@ const ContributorsPage = () => { return (
- + 🤝 Contributors + + setSearchTerm(e.target.value)} + sx={{ + width: { + xs: "100%", + sm: "400px", + }, + maxWidth: "100%", + backgroundColor: "white", + borderRadius: "10px", + }} + InputProps={{ + startAdornment: ( + + + + ), + }} + /> + - - {contributors.map((contributor) => ( - - + {filteredContributors.length === 0 && ( + + No contributors found. + + )} + {filteredContributors.map((contributor) => ( + + + - - - - - {contributor.login} - + + + + {contributor.login} + - - {contributor.contributions} Contributions - - {/* + + {contributor.contributions} Contributions + + {/* Thank you for your valuable contributions to our community! */} - - + + - - - - + + + + ))}