Skip to content

Commit e065a4d

Browse files
committed
Use official platform SVG icons
1 parent 52f9488 commit e065a4d

11 files changed

Lines changed: 246 additions & 68 deletions

File tree

app/public/css/application.css

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -263,33 +263,19 @@ tr:last-child td {
263263
}
264264

265265
.platform-mark {
266-
border: 1px solid var(--line);
267-
border-radius: 4px;
268-
color: var(--muted);
269266
display: inline-block;
270-
font-size: 0.68rem;
271-
font-weight: 900;
267+
height: 16px;
272268
line-height: 1;
273269
margin-right: 6px;
274-
padding: 3px 4px;
275-
vertical-align: 1px;
276-
}
277-
278-
.platform-mark--github {
279-
background: #f3f4f6;
280-
color: #24292f;
270+
vertical-align: -2px;
271+
width: 16px;
281272
}
282273

283-
.platform-mark--gitlab {
284-
background: #fff7ed;
285-
border-color: #fdba74;
286-
color: #c2410c;
287-
}
288-
289-
.platform-mark--codeberg {
290-
background: #eff6ff;
291-
border-color: #93c5fd;
292-
color: #1d4ed8;
274+
.platform-mark__icon {
275+
display: block;
276+
height: 16px;
277+
object-fit: contain;
278+
width: 16px;
293279
}
294280

295281
.muted-link {
@@ -497,35 +483,13 @@ td span {
497483
margin-bottom: 20px;
498484
}
499485

500-
.platform-logo svg {
486+
.platform-logo__image {
501487
display: block;
502488
height: 64px;
489+
object-fit: contain;
503490
width: 64px;
504491
}
505492

506-
.platform-logo circle,
507-
.platform-logo path {
508-
fill: currentColor;
509-
}
510-
511-
.platform-logo text {
512-
fill: #ffffff;
513-
font-size: 16px;
514-
font-weight: 900;
515-
}
516-
517-
.platform-card--github .platform-logo {
518-
color: #24292f;
519-
}
520-
521-
.platform-card--gitlab .platform-logo {
522-
color: #e24329;
523-
}
524-
525-
.platform-card--codeberg .platform-logo {
526-
color: #2185d0;
527-
}
528-
529493
.about-author {
530494
background: #10231f;
531495
color: #ffffff;

app/public/icons/codeberg.svg

Lines changed: 164 additions & 0 deletions
Loading

app/public/icons/github.svg

Lines changed: 10 additions & 0 deletions
Loading

app/public/icons/gitlab.svg

Lines changed: 22 additions & 0 deletions
Loading

app/views/about.erb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,33 +64,21 @@
6464
<div class="platform-grid">
6565
<article class="platform-card platform-card--github">
6666
<div class="platform-logo" aria-hidden="true">
67-
<svg viewBox="0 0 64 64" role="img">
68-
<circle cx="32" cy="32" r="28"></circle>
69-
<text x="32" y="38" text-anchor="middle">GH</text>
70-
</svg>
67+
<img class="platform-logo__image" src="<%= h app_path(platform_icon_path("github")) %>" alt="" width="64" height="64">
7168
</div>
7269
<h3>GitHub</h3>
73-
<p>Publiczne profile, repozytoria, gwiazdki, stargazer history i public activity events.</p>
7470
</article>
7571
<article class="platform-card platform-card--gitlab">
7672
<div class="platform-logo" aria-hidden="true">
77-
<svg viewBox="0 0 64 64" role="img">
78-
<path d="M32 6 56 22 47 54H17L8 22Z"></path>
79-
<text x="32" y="38" text-anchor="middle">GL</text>
80-
</svg>
73+
<img class="platform-logo__image" src="<%= h app_path(platform_icon_path("gitlab")) %>" alt="" width="64" height="64">
8174
</div>
8275
<h3>GitLab</h3>
83-
<p>Publiczne profile, projekty, gwiazdki projektów i publiczne zdarzenia użytkowników.</p>
8476
</article>
8577
<article class="platform-card platform-card--codeberg">
8678
<div class="platform-logo" aria-hidden="true">
87-
<svg viewBox="0 0 64 64" role="img">
88-
<path d="M8 50 28 14l8 14 6-9 14 31Z"></path>
89-
<text x="32" y="54" text-anchor="middle">CB</text>
90-
</svg>
79+
<img class="platform-logo__image" src="<%= h app_path(platform_icon_path("codeberg")) %>" alt="" width="64" height="64">
9180
</div>
9281
<h3>Codeberg</h3>
93-
<p>Publiczne profile, repozytoria, gwiazdki i publiczna aktywność z instancji Codeberg.</p>
9482
</article>
9583
</div>
9684
</div>

app/views/editions.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<ol class="edition-toplist">
4747
<% edition.fetch(:repositories).each do |row| %>
4848
<li>
49-
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><span class="platform-mark platform-mark--<%= h row.fetch(:platform, "github") %>"><%= h platform_mark(row.fetch(:platform, "github")) %></span><%= h row.fetch(:full_name) %></a>
49+
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><%= erb :platform_icon, locals: { platform: row.fetch(:platform, "github") } %><%= h row.fetch(:full_name) %></a>
5050
<span><%= number(row.fetch(:stargazers_count)) %> gwiazdek</span>
5151
</li>
5252
<% end %>
@@ -58,7 +58,7 @@
5858
<ol class="edition-toplist">
5959
<% edition.fetch(:users_by_stars).each do |row| %>
6060
<li>
61-
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><span class="platform-mark platform-mark--<%= h row.fetch(:platform, "github") %>"><%= h platform_mark(row.fetch(:platform, "github")) %></span><%= h row.fetch(:login) %></a>
61+
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><%= erb :platform_icon, locals: { platform: row.fetch(:platform, "github") } %><%= h row.fetch(:login) %></a>
6262
<span><%= number(row.fetch(:total_stars)) %> gwiazdek</span>
6363
</li>
6464
<% end %>
@@ -70,7 +70,7 @@
7070
<ol class="edition-toplist">
7171
<% edition.fetch(:users_by_activity).each do |row| %>
7272
<li>
73-
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><span class="platform-mark platform-mark--<%= h row.fetch(:platform, "github") %>"><%= h platform_mark(row.fetch(:platform, "github")) %></span><%= h row.fetch(:login) %></a>
73+
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><%= erb :platform_icon, locals: { platform: row.fetch(:platform, "github") } %><%= h row.fetch(:login) %></a>
7474
<span><%= number(row.fetch(:public_activity_count)) %> zdarzeń</span>
7575
</li>
7676
<% end %>

app/views/platform_icon.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<% platform = platform || "github" %>
2+
<span class="platform-mark platform-mark--<%= h platform %>">
3+
<img class="platform-mark__icon" src="<%= h app_path(platform_icon_path(platform)) %>" alt="<%= h platform_name(platform) %>" width="16" height="16">
4+
</span>

app/views/repository_table.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tr>
1515
<td><%= index + 1 %></td>
1616
<td>
17-
<span class="platform-mark platform-mark--<%= h row.fetch(:platform, "github") %>"><%= h platform_mark(row.fetch(:platform, "github")) %></span>
17+
<%= erb :platform_icon, locals: { platform: row.fetch(:platform, "github") } %>
1818
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><%= h row.fetch(:full_name) %></a>
1919
<% if row[:description] && !row[:description].empty? %>
2020
<span><%= h row[:description] %></span>

app/views/user_table.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tr>
1515
<td><%= index + 1 %></td>
1616
<td>
17-
<span class="platform-mark platform-mark--<%= h row.fetch(:platform, "github") %>"><%= h platform_mark(row.fetch(:platform, "github")) %></span>
17+
<%= erb :platform_icon, locals: { platform: row.fetch(:platform, "github") } %>
1818
<a class="primary-link" href="<%= h row.fetch(:html_url) %>"><%= h row.fetch(:login) %></a>
1919
<% if row[:name] && !row[:name].empty? %>
2020
<span><%= h row[:name] %></span>

lib/polish_github_rank/web/app.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,20 @@ def number(value)
1919
value.to_i.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1 ').reverse
2020
end
2121

22-
def platform_mark(platform)
23-
{ 'codeberg' => 'CB', 'gitlab' => 'GL' }.fetch(platform, 'GH')
22+
def platform_name(platform)
23+
{
24+
'codeberg' => 'Codeberg',
25+
'gitlab' => 'GitLab',
26+
'github' => 'GitHub'
27+
}.fetch(platform, 'GitHub')
28+
end
29+
30+
def platform_icon_path(platform)
31+
{
32+
'codeberg' => '/icons/codeberg.svg',
33+
'gitlab' => '/icons/gitlab.svg',
34+
'github' => '/icons/github.svg'
35+
}.fetch(platform, '/icons/github.svg')
2436
end
2537

2638
def scopes

0 commit comments

Comments
 (0)