og/views/user.eta
2023-12-21 08:21:50 -06:00

75 lines
1.8 KiB
Text

<% 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 class="word name"><%= it.user.full_name || it.user.username %></span>
<span class="word 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;
gap: 1rem;
align-items: center;
}
.user .title .name {
font-size: 4rem;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
}
.user .title .username {
font-size: 3.5rem;
font-weight: 400;
color: #6d728f;
overflow: hidden;
text-overflow: ellipsis;
}
.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>