Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved user profile styling #64

Merged
merged 1 commit into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"devDependencies": {
"codecov": "^2.1.0",
"istanbul": "^0.4.5",
"nodemon": "^1.11.0",
"shot": "^3.4.0",
"tap-spec": "^4.1.1",
"tape": "^4.6.3"
Expand Down
66 changes: 59 additions & 7 deletions public/user.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,72 @@
html, body {
margin: 0 auto;
font-size: 1.2em;
font-family: 'Raleway', sans-serif;
}

h1 {
margin-top: 0;
text-align: center;
}

.userprofile {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 2rem;
max-width: 40rem;
border-radius: 1rem;
border: 2px solid rgba(0, 0, 0, 0.5);
margin: 2rem auto;
transition: 0.4s all ease;
}

.userprofile:hover {
-webkit-box-shadow: .5rem .5rem 0.33rem 0px rgba(0,0,0,0.10);
-moz-box-shadow: .5rem .5rem 0.33rem 0px rgba(0,0,0,0.10);
box-shadow: .5rem .5rem 0.33rem 0px rgba(0,0,0,0.10);
}

img {
width: 30%;
.userprofile__image {
margin: 2rem auto;
overflow: hidden;
width: 15rem;
height: 15rem;
text-decoration: none;
border-radius: 50%;
display: block;
}

ul {
.userprofile__image__img {
border-radius: 50%;
width: 100%;
opacity: 1;
transition: .5s all ease;
}

.userprofile__image__back {
width: 15rem;
height: 15rem;
line-height: 15rem;
color: white;
text-align: center;
font-size: 2rem;
font-weight: bold;
}

.userprofile__image:hover .userprofile__image__back {
margin-top: -15rem;
color: black;
}
.userprofile__image:hover .userprofile__image__img {
opacity: 0.5;
}

table {
margin: 0 auto;
max-width: 46rem;
list-style-type: none;
}
td {
padding: 0.5rem;
}
tr:nth-child(odd) {
background-color: rgba(0,0,0,0.05);
}
1 change: 1 addition & 0 deletions src/assets/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/../../public/user.css">
<title>SoFly presents: FAC10 FACts</title>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<main class="userprofile">
Expand Down
25 changes: 14 additions & 11 deletions src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,20 @@ handler.userSearch = (req, res) => {
data.getUser(userId, (err, user) => {
const userHtml =
`<h1>${user.first_name} ${user.middle_name || ''} ${user.last_name}</h1>
<img class="userimg" src=${'../public/assets/profile-pics/' + user.first_name.toLowerCase() + '_headshot.jpg'}>
<ul>
<li>Github username: <a href="${'https://www.github.com/'+user.github_user_name}">${user.github_user_name}</a></li>
<li>Nationality: ${user.nationality}</li>
<li>Languages spoken: ${user.languages}</li>
<li>Place of birth: ${user.place_of_birth}</li>
<li>Favourite hobby: ${user.favorite_hobby}</li>
<li>Favourite book: ${user.favorite_book}</li>
<li>Number of siblings: ${user.siblings}</li>
</ul>`;

<a class="userprofile__image" href="/">
<img class="userprofile__image__img" src=${'../public/assets/profile-pics/' + user.first_name.toLowerCase() + '_headshot.jpg'}>
<section class="userprofile__image__back">Go back</section>
</a>
<table>

<tr><td>Github: </td><td><a href="${'https://www.github.com/'+user.github_user_name}">${user.github_user_name}</a></td></tr>
<tr><td>Nationality: </td><td>${user.nationality}</td></tr>
<tr><td>Languages: </td><td>${user.languages}</td></tr>
<tr><td>Place of birth: </td><td>${user.place_of_birth}</td></tr>
<tr><td>Favourite hobby: </td><td>${user.favorite_hobby}</td></tr>
<tr><td>Favourite book: </td><td>${user.favorite_book}</td></tr>
<tr><td>Siblings: </td><td>${user.siblings}</td></tr>
</table>`;

const html = file.replace(/<!--REPLACETHIS-->/, userHtml);

Expand Down