add user profile templating
This commit is contained in:
parent
f0fc3df881
commit
1dafd75723
4 changed files with 115 additions and 6 deletions
71
views/user.eta
Normal file
71
views/user.eta
Normal file
|
@ -0,0 +1,71 @@
|
|||
<% layout('layout') %>
|
||||
<%
|
||||
let description = it.user.description?.replace(/https?:\/\/([\S]+)/g, '$1')
|
||||
function prettyNumber(number) {
|
||||
if (number < 30) return number
|
||||
if (number < 1000) return Math.floor(number/10) * 10 + '+'
|
||||
return Math.floor(number / 1000)+'k'
|
||||
}
|
||||
%>
|
||||
<div class="main user">
|
||||
<div class="contents">
|
||||
<div class="info">
|
||||
<p class="title"><span><%= it.user.full_name || it.user.username %></span> <span class="username">@<%= it.user.username %></span></p>
|
||||
<p class="description"><%= description %></p>
|
||||
</div>
|
||||
<div class="graphics">
|
||||
<% if (it.user.avatar_url) { %>
|
||||
<img width="120" height="120" src="<%= it.user.avatar_url %>"></img>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-line">
|
||||
<div class="fact">
|
||||
<p class="fact-heading"><%= it.user.followers_count %></p>
|
||||
<p class="fact-subtitle">Followers</p>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<p class="fact-heading"><%= it.user.following_count %></p>
|
||||
<p class="fact-subtitle">Following</p>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<p class="fact-heading"><%= prettyNumber(it.user.repo_count) %></p>
|
||||
<p class="fact-subtitle">Repos</p>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<p class="fact-heading"><%= it.user.starred_repos_count %></p>
|
||||
<p class="fact-subtitle">Stars Given</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.user .title {
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
}
|
||||
.user .title span:not(.username) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
font-size: 3rem;
|
||||
font-weight: 600;
|
||||
color: #aeb3d0;
|
||||
}
|
||||
.user .title .username {
|
||||
font-size: 1.75rem;
|
||||
gap: 0.5rem;
|
||||
font-weight: 400;
|
||||
color: #6d728f;
|
||||
}
|
||||
.fact {
|
||||
display: flex;
|
||||
margin-right: 0.5em;
|
||||
font-size: 1.5rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
.fact-heading {
|
||||
color: #8c91af;
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue