add info-line to repo template

This commit is contained in:
hazycora 2023-08-02 22:50:27 -05:00
parent 61e9ab6f06
commit ffe5e13a80
No known key found for this signature in database
GPG key ID: 215AF1F81F86940E
2 changed files with 38 additions and 0 deletions

View file

@ -129,3 +129,19 @@ p {
margin: 0;
border-radius: 100%;
}
.repo .info-line {
gap: 1em;
}
.repo-fact {
display: flex;
font-size: 1.5rem;
flex-direction: column;
}
.repo-fact .fact-heading {
color: #8c91af;
font-size: 2rem;
font-weight: 500;
}

View file

@ -1,4 +1,10 @@
<% layout('layout') %>
<%
function prettyNumber(number) {
if (number < 1000) return number
return Math.floor(number / 1000)+'k'
}
%>
<div class="main repo">
<div class="contents">
<div class="info">
@ -12,4 +18,20 @@
<img width="120" height="120" src="<%= it.repo.avatar_url || it.repo.owner.avatar_url %>"></img>
</div>
</div>
<% if (it.repo.open_issues_count > 0 || it.repo.stars_count > 0 || it.repo.forks_count > 0) { %>
<div class="info-line">
<div class="repo-fact">
<p class="fact-heading"><%= prettyNumber(it.repo.open_issues_count) %></p>
<p class="fact-subtitle"><%= (it.repo.open_issues_count) != 1 ? 'Issues' : 'Issue' %></p>
</div>
<div class="repo-fact">
<p class="fact-heading"><%= prettyNumber(it.repo.stars_count) %></p>
<p class="fact-subtitle"><%= (it.repo.stars_count) != 1 ? 'Stars' : 'Star' %></p>
</div>
<div class="repo-fact">
<p class="fact-heading"><%= prettyNumber(it.repo.forks_count) %></p>
<p class="fact-subtitle"><%= (it.repo.forks_count) != 1 ? 'Forks' : 'Fork' %></p>
</div>
</div>
<% } %>
</div>