From 331a4bbeacc407d828e6f56603ea99051846b616 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Thu, 10 Oct 2019 12:37:24 +0100 Subject: [PATCH] End of chapter 23 --- .idea/workspace.xml | 18 +++++--- src/components/users/User.js | 84 +++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 8 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 656d83c..bd3fb5e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,8 @@ - - - + @@ -206,6 +211,7 @@ - \ No newline at end of file diff --git a/src/components/users/User.js b/src/components/users/User.js index d388db5..da6f203 100644 --- a/src/components/users/User.js +++ b/src/components/users/User.js @@ -1,13 +1,23 @@ -import React, { Component } from "react"; +import React, { Component, Fragment } from "react"; +import Spinner from "../layout/Spinner"; +import PropTypes from "prop-types"; +import { Link } from "react-router-dom"; class User extends Component { componentDidMount() { this.props.getUser(this.props.match.params.login); } + static propTypes = { + loading: PropTypes.bool, + user: PropTypes.object.isRequired, + getUser: PropTypes.func.isRequired + }; + render() { const { name, + company, avatar_url, location, bio, @@ -22,7 +32,77 @@ class User extends Component { } = this.props.user; const { loading } = this.props; - return
{name}
; + + if (loading) return ; + + return ( + + {name} + + Back to search + + Hireable:{" "} + {hireable ? ( + + ) : ( + + )} +
+
+ +

{name}

+

Location: {location}

+
+
+ {bio && ( + +

Bio

+

{bio}

+
+ )} + + Visit Github + +
    +
  • + {login && ( + + Username: {login} + + )} +
  • + +
  • + {company && ( + + Company: {company} + + )} +
  • + +
  • + {blog && ( + + Website: {blog} + + )} +
  • +
+
+
+
+
Followers: {followers}
+
Following: {following}
+
Public Repos: {public_repos}
+
Public Gists: {public_gists}
+
+
+ ); } }