From 965c4c78fa52c02c25983b29de7ee19ac9f36a47 Mon Sep 17 00:00:00 2001 From: Vignesh Raj <53948153+vigneshrajj@users.noreply.github.com> Date: Sat, 6 Mar 2021 14:23:42 +0530 Subject: [PATCH] ui improvised --- src/App.js | 90 +++++++++++++++---------------- src/Components/Footer/Footer.css | 7 ++- src/Components/Profile/Profile.js | 36 ++++++------- src/index.css | 31 ++++++++--- 4 files changed, 93 insertions(+), 71 deletions(-) diff --git a/src/App.js b/src/App.js index e97b180..1b6a70c 100644 --- a/src/App.js +++ b/src/App.js @@ -1,19 +1,23 @@ -import React, { Component } from 'react'; -import axios from 'axios'; +import React, { Component } from "react"; +import axios from "axios"; // import custom components -import Profile from './Components/Profile/Profile'; -import Footer from './Components/Footer/Footer'; +import Profile from "./Components/Profile/Profile"; +import Footer from "./Components/Footer/Footer"; // import material-ui components -import { TextField, Button, CircularProgress as Loader } from '@material-ui/core'; +import { + TextField, + Button, + CircularProgress as Loader +} from "@material-ui/core"; class App extends Component { state = { - username: '', - image: '', + username: "", + image: "", searched: false, repos: [], loading: false - } + }; onFormSubmit = (e) => { e.preventDefault(); @@ -24,38 +28,39 @@ class App extends Component { var avatar_url; - axios.get(`https://api.github.com/users/${this.state.username}`) - .then(res => { - avatar_url = res.data.avatar_url; - return axios.get(res.data.repos_url); - }) - .then(res => { - this.setState({ - loading: false, - repos: res.data, - image: avatar_url, - searched: true - }); - }) - .catch(() => { - this.setState({ - loading: false + axios + .get(`https://api.github.com/users/${this.state.username}`) + .then((res) => { + avatar_url = res.data.avatar_url; + return axios.get(res.data.repos_url); + }) + .then((res) => { + this.setState({ + loading: false, + repos: res.data, + image: avatar_url, + searched: true + }); + }) + .catch(() => { + this.setState({ + loading: false + }); }); - }); - } + }; - onUsernameChange = e => { + onUsernameChange = (e) => { this.setState({ searched: false, username: e.target.value }); - } + }; render() { return (