diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d6ea8e7c..04d12e58 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -31,6 +31,7 @@ import EditPost from "./pages/EditPost"; import useTheme from './hooks/useTheme'; import CodeEditor from "./pages/CodeEditor"; import TrendingPosts from "./pages/TrendingPosts"; +import Contributors from "./pages/Contributors"; // import axios from "axios"; // axios.defaults.baseURL = "http://localhost:3001/"; @@ -49,6 +50,7 @@ function App() { } /> } /> } /> + }/> } /> { +
  • + Our Contributors +
  • diff --git a/frontend/src/pages/Contributors.tsx b/frontend/src/pages/Contributors.tsx new file mode 100644 index 00000000..c5fa88e4 --- /dev/null +++ b/frontend/src/pages/Contributors.tsx @@ -0,0 +1,66 @@ +import React, { useEffect, useState } from 'react'; +import axios from 'axios'; + +interface Contributor { + id: number; + login: string; + html_url: string; + avatar_url: string; + contributions: number; +} + +const Contributors: React.FC = () => { + const [contributors, setContributors] = useState([]); + + useEffect(() => { + async function fetchContributors() { + try { + const response = await axios.get( + 'https://api.github.com/repos/VaibhavArora314/StyleShare/contributors' + ); + setContributors(response.data); + } catch (error) { + console.error('Error fetching contributors:', error); + } + } + fetchContributors(); + }, []); + + return ( +
    +
    +

    Contributors

    +
    + {contributors.map((contributor) => ( +
    + + {contributor.login} + +

    + {contributor.login} +

    +

    + Contributions: {contributor.contributions} +

    +
    + ))} +
    +
    +
    + ); +}; + +export default Contributors; +