├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── src ├── components │ ├── about.js │ ├── notfound.js │ ├── navbar.js │ ├── users.js │ ├── home.js │ ├── userProfile.js │ ├── login.js │ ├── authProfile.js │ ├── searchUser.js │ ├── styles.css │ └── repoDetail.js ├── setupTests.js ├── App.test.js ├── App.css ├── reportWebVitals.js ├── index.js ├── routes.js ├── index.css ├── App.js └── logo.svg ├── .gitignore ├── package.json └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kolosafo/git-explorer-final/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kolosafo/git-explorer-final/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kolosafo/git-explorer-final/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/components/about.js: -------------------------------------------------------------------------------- 1 | const AboutUs = () =>

About Us Page

; 2 | 3 | export default AboutUs; 4 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .fade-enter{ 2 | opacity: 0; 3 | } 4 | 5 | .fade-enter-active{ 6 | opacity: 1; 7 | transition: opacity 300ms ease-in; 8 | } 9 | 10 | .fade-exit{ 11 | opacity: 1; 12 | } 13 | 14 | .fade-exit-active{ 15 | opacity: 0; 16 | transition: opacity 300ms ease-out; 17 | } -------------------------------------------------------------------------------- /src/components/notfound.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link } from "react-router-dom"; 3 | const NotFound = () => { 4 | return ( 5 |
6 |

Page Not Found

7 | Go Back To Home Page 8 |
9 | ); 10 | }; 11 | 12 | export default NotFound; 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/components/navbar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Outlet, Link } from "react-router-dom"; 3 | import "./styles.css"; 4 | 5 | const Navbar = ({ isLogged }) => { 6 | return ( 7 | <> 8 | 20 | 21 | 22 | ); 23 | }; 24 | 25 | export default Navbar; 26 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | import reportWebVitals from "./reportWebVitals"; 6 | import { BrowserRouter } from "react-router-dom"; 7 | import Navbar from "./components/navbar"; 8 | 9 | const root = ReactDOM.createRoot(document.getElementById("root")); 10 | root.render( 11 | 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | 19 | // If you want to start measuring performance in your app, pass a function 20 | // to log results (for example: reportWebVitals(console.log)) 21 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 22 | reportWebVitals(); 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git-explorer", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "axios": "^1.4.0", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0", 12 | "react-router-dom": "^6.11.2", 13 | "react-scripts": "5.0.1", 14 | "react-transition-group": "^4.4.5", 15 | "web-vitals": "^2.1.4" 16 | }, 17 | "scripts": { 18 | "start": "react-scripts start", 19 | "build": "react-scripts build", 20 | "test": "react-scripts test", 21 | "eject": "react-scripts eject" 22 | }, 23 | "eslintConfig": { 24 | "extends": [ 25 | "react-app", 26 | "react-app/jest" 27 | ] 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.2%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/components/users.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import React, { useEffect, useState } from "react"; 3 | import { Link, useNavigate } from "react-router-dom"; 4 | 5 | const Users = () => { 6 | //State management 7 | const [gitUsers, setGitUsers] = useState([]); 8 | const navigate = useNavigate(); 9 | 10 | const getGitUsers = async () => { 11 | const response = await axios.get("https://api.github.com/users?since=XXXX"); 12 | console.log(response.data); 13 | setGitUsers(response.data); 14 | return response.data; 15 | }; 16 | 17 | useEffect(() => { 18 | getGitUsers().catch((e) => console.error(e)); 19 | }, []); 20 | return ( 21 |
22 | {" "} 23 |
24 | {gitUsers.map((user) => ( 25 |
26 | userAvatar 31 | {user.login} 32 | 38 |
39 | ))} 40 |
41 |
42 | ); 43 | }; 44 | 45 | export default Users; 46 | -------------------------------------------------------------------------------- /src/routes.js: -------------------------------------------------------------------------------- 1 | import { lazy } from "react"; 2 | 3 | import Home from "./components/home"; 4 | const Users = lazy(() => import("./components/users")); 5 | const UserProfile = lazy(() => import("./components/userProfile")); 6 | const SearchUser = lazy(() => import("./components/searchUser")); 7 | const Login = lazy(() => import("./components/login")); 8 | const AuthProfile = lazy(() => import("./components/authProfile")); 9 | const AboutUs = lazy(() => import("./components/about")); 10 | const RepoDetail = lazy(() => import("./components/repoDetail")); 11 | const NotFound = lazy(() => import("./components/notfound")); 12 | 13 | export const appRoutes = [ 14 | { 15 | path: "/", 16 | component: Home, 17 | requiresAuth: false, 18 | }, 19 | { 20 | path: "/login", 21 | component: Login, 22 | requiresAuth: false, 23 | }, 24 | { 25 | path: "/users", 26 | component: Users, 27 | requiresAuth: false, 28 | }, 29 | { 30 | path: "/authProfile", 31 | component: AuthProfile, 32 | requiresAuth: true, 33 | }, 34 | { 35 | path: "/search", 36 | component: SearchUser, 37 | requiresAuth: false, 38 | }, 39 | { 40 | path: "/users/user/:username", 41 | component: UserProfile, 42 | requiresAuth: false, 43 | }, 44 | { 45 | path: "/about", 46 | component: AboutUs, 47 | requiresAuth: false, 48 | }, 49 | { 50 | path: "/repo-detail/:name/:username", 51 | component: RepoDetail, 52 | requiresAuth: false, 53 | }, 54 | { 55 | path: "*", 56 | component: NotFound, 57 | requiresAuth: false, 58 | }, 59 | ]; 60 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; 3 | line-height: 1.5; 4 | font-weight: 400; 5 | 6 | color-scheme: light dark; 7 | color: rgba(255, 255, 255, 0.87); 8 | background-color: #242424; 9 | 10 | font-synthesis: none; 11 | text-rendering: optimizeLegibility; 12 | -webkit-font-smoothing: antialiased; 13 | -moz-osx-font-smoothing: grayscale; 14 | -webkit-text-size-adjust: 100%; 15 | } 16 | #root { 17 | max-width: 1280px; 18 | margin: 0 auto; 19 | padding: 2rem; 20 | text-align: center; 21 | } 22 | a { 23 | font-weight: 500; 24 | color: #646cff; 25 | text-decoration: inherit; 26 | } 27 | a:hover { 28 | color: #535bf2; 29 | } 30 | 31 | body { 32 | margin: 0; 33 | display: flex; 34 | place-items: center; 35 | min-width: 320px; 36 | min-height: 100vh; 37 | } 38 | 39 | h1 { 40 | font-size: 3.2em; 41 | line-height: 1.1; 42 | } 43 | 44 | button { 45 | border-radius: 8px; 46 | border: 1px solid transparent; 47 | padding: 0.6em 1.2em; 48 | font-size: 1em; 49 | font-weight: 500; 50 | font-family: inherit; 51 | background-color: #1a1a1a; 52 | cursor: pointer; 53 | transition: border-color 0.25s; 54 | } 55 | button:hover { 56 | border-color: #646cff; 57 | } 58 | button:focus, 59 | button:focus-visible { 60 | outline: 4px auto -webkit-focus-ring-color; 61 | } 62 | 63 | @media (prefers-color-scheme: light) { 64 | :root { 65 | color: #213547; 66 | background-color: #ffffff; 67 | } 68 | a:hover { 69 | color: #747bff; 70 | } 71 | button { 72 | background-color: #f9f9f9; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/components/home.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import React, { useEffect, useState } from "react"; 3 | import "./styles.css"; 4 | import { Link } from "react-router-dom"; 5 | 6 | const RepoList = () => { 7 | //State management 8 | const [repos, setRepos] = useState(null); 9 | const gitRepos = async () => { 10 | const response = await axios.get( 11 | "https://api.github.com/search/repositories?q=XXX" 12 | ); 13 | console.log(response.data.items); 14 | setRepos(response.data.items); 15 | return response.data; 16 | }; 17 | useEffect(() => { 18 | gitRepos().catch((e) => console.error(e)); 19 | }, []); 20 | return ( 21 |
22 | {repos ? ( 23 | repos.map((repo) => ( 24 |
25 | userAvatar 30 | {repo.name} 31 | 32 | Language: {repo.language} 33 |
34 | By:{" "} 35 | 39 | {repo.owner.login} 40 | 41 |
42 | 43 | 44 | 45 | 46 |
47 | )) 48 | ) : ( 49 |

Loading...

50 | )} 51 | Go To Users Page 52 |
53 | ); 54 | }; 55 | 56 | export default RepoList; 57 | -------------------------------------------------------------------------------- /src/components/userProfile.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import React, { useEffect, useState } from "react"; 3 | import "./styles.css"; 4 | import { useParams } from "react-router-dom"; 5 | 6 | const UserProfile = () => { 7 | const [gitUserData, setGitUserData] = useState({}); 8 | 9 | 10 | const { username } = useParams(); 11 | 12 | 13 | useEffect(() => { 14 | const getGitUser = async () => { 15 | const response = await axios.get( 16 | `https://api.github.com/users/${username}` 17 | ); 18 | console.log("USER IS HERE", response.data); 19 | setGitUserData(response.data); 20 | return response.data; 21 | }; 22 | getGitUser().catch((e) => console.error(e)); 23 | }, [username]); 24 | return ( 25 |
26 |
27 | user-img{" "} 32 |
33 | {gitUserData.login} 34 |

{gitUserData.name}

35 |

{gitUserData.location}

36 |
37 | 38 | Followers: {gitUserData.followers} 39 | 40 | Following: {gitUserData.following} 41 |
42 | 48 | View on GitHub 49 | 50 |
51 |
52 |
53 |

{gitUserData.bio}

54 |
55 |
56 | ); 57 | }; 58 | 59 | export default UserProfile; 60 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import "./App.css"; 2 | import { Route, Routes, Navigate, useLocation } from "react-router-dom"; 3 | import React, { useState, Suspense } from "react"; 4 | import { SwitchTransition, CSSTransition } from "react-transition-group"; 5 | import { appRoutes } from "./routes"; 6 | 7 | 8 | function App() { 9 | const [username, setUsername] = useState(""); 10 | const [isLogged, setIsLogged] = useState(false); 11 | const location = useLocation(); 12 | return ( 13 | 14 | 20 |

Loading...

}> 21 | 22 | {appRoutes.map((route) => { 23 | if (route.requiresAuth && !isLogged) { 24 | return ( 25 | } 30 | /> 31 | ); 32 | } else { 33 | return ( 34 | 44 | } 45 | /> 46 | ); 47 | } 48 | })} 49 | 50 |
51 |
52 |
53 | ); 54 | } 55 | 56 | export default App; 57 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/login.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { useNavigate } from "react-router-dom"; 3 | 4 | const Login = ({ setIsLogged, setUsername }) => { 5 | const [loginUsername, setLoginUsername] = useState(""); 6 | const [password, setPassword] = useState(""); 7 | const [errorMsg, setErrorMsg] = useState(""); 8 | 9 | //NAVIGATION 10 | const navigate = useNavigate(); 11 | 12 | const dummyUserObject = { 13 | username: "Kolosafo", 14 | password: "12345", 15 | }; 16 | const handleLogin = (e) => { 17 | e.preventDefault(); 18 | if ( 19 | loginUsername === dummyUserObject.username && 20 | password === dummyUserObject.password 21 | ) { 22 | setUsername(loginUsername); 23 | setIsLogged(true); 24 | navigate("/authProfile"); 25 | } else { 26 | setErrorMsg("Invalid Credentials"); 27 | } 28 | }; 29 | return ( 30 |
31 | {errorMsg} 32 | 35 | { 40 | setLoginUsername(e.target.value); 41 | setErrorMsg(""); 42 | }} 43 | className="login-inp" 44 | placeholder="username" 45 | /> 46 | 49 | { 55 | setPassword(e.target.value); 56 | setErrorMsg(""); 57 | }} 58 | placeholder="password" 59 | /> 60 | 61 |
62 | ); 63 | }; 64 | 65 | export default Login; 66 | -------------------------------------------------------------------------------- /src/components/authProfile.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import React, { useEffect, useState } from "react"; 3 | 4 | const AuthProfile = ({ username }) => { 5 | const [gitUserData, setGitUserData] = useState({}); 6 | 7 | useEffect(() => { 8 | const getGitUser = async () => { 9 | const response = await axios.get( 10 | `https://api.github.com/users/${username}` 11 | ); 12 | console.log("USER IS HERE", response.data); 13 | setGitUserData(response.data); 14 | return response.data; 15 | }; 16 | getGitUser().catch((e) => console.error(e)); 17 | }, []); 18 | return ( 19 |
20 |

YOUR PROFILE

21 |
22 | user-img{" "} 27 |
28 | {gitUserData.login} 29 |

{gitUserData.name}

30 |
31 | 32 | Company:{" "} 33 | 34 | {gitUserData.company} 35 | 36 | 37 | Public Repos: {gitUserData.public_repos} 38 |
39 |

{gitUserData.location}

40 |
41 | 42 | Followers: {gitUserData.followers} 43 | 44 | Following: {gitUserData.following} 45 |
46 | 52 | View on GitHub 53 | 54 |
55 |
56 |
57 |

{gitUserData.bio}

58 |
59 |
60 | ); 61 | }; 62 | 63 | export default AuthProfile; 64 | -------------------------------------------------------------------------------- /src/components/searchUser.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import React, { useEffect, useState } from "react"; 3 | import "./styles.css"; 4 | import { useNavigate } from "react-router-dom"; 5 | 6 | const SearchUser = () => { 7 | const [username, setUsername] = useState(null); 8 | const [errorMsg, setErrorMsg] = useState(null); 9 | const [loading, setLoading] = useState("Submit"); 10 | const [attempts, setAttempts] = useState(3); 11 | 12 | const navigate = useNavigate(); 13 | 14 | const handleGetUser = async (e) => { 15 | const response = await axios.get( 16 | `https://api.github.com/users/${username}` 17 | ); 18 | if (response.status === 200) { 19 | // REDIRECT 20 | navigate(`/users/user/${username}`); 21 | } 22 | return response; 23 | }; 24 | 25 | const handleSubmit = async (e) => { 26 | e.preventDefault(); 27 | setLoading("Loading..."); 28 | if (username) { 29 | handleGetUser().catch(() => { 30 | setLoading("Submit"); 31 | setAttempts((currentAttempt) => currentAttempt - 1); 32 | setErrorMsg(`User Does Not Exist! ${attempts - 1} Attempts remaining`); 33 | }); 34 | } 35 | }; 36 | useEffect(() => { 37 | if (attempts <= 0) { 38 | setErrorMsg("Too many attempts, REDIRECTING..."); 39 | setTimeout(() => { 40 | navigate("/"); 41 | }, 3000); 42 | } 43 | }, [attempts, navigate]); 44 | return ( 45 | <> 46 |

Search User

47 |
48 | {errorMsg && ( 49 | 50 | {" "} 51 | {errorMsg} 52 | 53 | )} 54 | { 59 | setUsername(e.target.value); 60 | setErrorMsg(null); 61 | }} 62 | value={username ? username : ""} 63 | /> 64 | 67 |
68 | 69 | ); 70 | }; 71 | 72 | export default SearchUser; 73 | -------------------------------------------------------------------------------- /src/components/styles.css: -------------------------------------------------------------------------------- 1 | .login-form { 2 | display: flex; 3 | flex-direction: column; 4 | } 5 | 6 | .login-inp { 7 | padding: 10px; 8 | border-radius: 10px; 9 | width: 400px; 10 | margin-bottom: 10px; 11 | } 12 | 13 | nav { 14 | position: absolute; 15 | top: 20px; 16 | left: 0; 17 | width: 100%; 18 | height: 50px; 19 | display: flex; 20 | justify-content: space-between; 21 | } 22 | 23 | .logo-nav { 24 | margin-left: 50px; 25 | margin-right: auto; 26 | } 27 | 28 | .link-cont { 29 | margin-right: 50px; 30 | width: 20%; 31 | display: flex; 32 | justify-content: space-around; 33 | } 34 | 35 | .users-cont { 36 | margin-top: 50px; 37 | display: flex; 38 | flex-wrap: wrap; 39 | } 40 | 41 | .repo-desc { 42 | font-size: 10px; 43 | } 44 | .username { 45 | margin-top: 15px; 46 | margin-bottom: 5px; 47 | } 48 | 49 | .repo-lang-span { 50 | color: orangered; 51 | font-size: 14px; 52 | margin-bottom: 5px; 53 | } 54 | .name-cont { 55 | flex: 1; 56 | display: flex; 57 | flex-direction: column; 58 | justify-content: center; 59 | } 60 | .repo-owner { 61 | color: lightpink; 62 | margin-bottom: 5px; 63 | cursor: pointer; 64 | } 65 | .avatar-img { 66 | width: 50%; 67 | } 68 | 69 | .clone-url-inp { 70 | padding: 10px; 71 | border-radius: 10px; 72 | border: 1px solid gray; 73 | margin-right: 5px; 74 | } 75 | 76 | .view-ongit-a { 77 | margin-bottom: 10px; 78 | } 79 | 80 | /* ///// */ 81 | 82 | .user-card-cont { 83 | display: flex; 84 | justify-content: center; 85 | align-items: center; 86 | width: 20%; 87 | padding: 10px; 88 | flex-direction: column; 89 | } 90 | 91 | .user-avatar { 92 | width: 70%; 93 | } 94 | .username { 95 | margin-top: 15px; 96 | margin-bottom: 5px; 97 | } 98 | @media only screen and (max-width: 768px) { 99 | .user-card-cont { 100 | width: 100%; 101 | } 102 | } 103 | 104 | /* ///// */ 105 | 106 | .top-cont { 107 | display: flex; 108 | } 109 | 110 | .user-avatar-img { 111 | width: 30%; 112 | } 113 | .name-cont { 114 | flex: 1; 115 | display: flex; 116 | flex-direction: column; 117 | justify-content: center; 118 | } 119 | .bottom-cont { 120 | flex: 1; 121 | border-top: 1px solid lightgray; 122 | margin-top: 10px; 123 | } 124 | 125 | .follow-cont { 126 | white-space: nowrap; 127 | } 128 | .followers { 129 | margin-right: 10px; 130 | margin-left: 20px; 131 | } 132 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/repoDetail.js: -------------------------------------------------------------------------------- 1 | import { useParams } from "react-router-dom"; 2 | import { useEffect, useState } from "react"; 3 | import axios from "axios"; 4 | import { Link } from "react-router-dom"; 5 | 6 | const RepoDetail = () => { 7 | const [gitRepoData, setGitRepoData] = useState(); 8 | const [cloneCopy, setCloneCopy] = useState(false); 9 | const { name, username } = useParams(); 10 | 11 | useEffect(() => { 12 | const getGitUser = async () => { 13 | const response = await axios.get( 14 | `https://api.github.com/repos/${username}/${name}` 15 | ); 16 | console.log("USER IS HERE", response.data); 17 | setGitRepoData(response.data); 18 | return response.data; 19 | }; 20 | getGitUser().catch((e) => console.error(e)); 21 | }, [username, name]); 22 | return ( 23 |
24 |
25 | {gitRepoData ? ( 26 | <> 27 | 33 |
34 | 35 | Owner:{" "} 36 | 37 | {gitRepoData.owner.login} 38 | 39 | 40 | 41 | Language: {gitRepoData.language} 42 | 43 |

{gitRepoData.name}

44 |
45 | 51 | View on GitHub 52 | 53 |
54 | 59 | 71 |
72 |
73 |
74 | 75 | ) : ( 76 |

Loadin...

77 | )} 78 |
79 |
80 | ); 81 | }; 82 | export default RepoDetail; 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | --------------------------------------------------------------------------------