Skip to content

Commit dd454e4

Browse files
authored
Merge pull request git#1986 from To1ne/toon-forges-logos
site-root: show forges logos on landing page
2 parents d16da59 + 984f3ff commit dd454e4

39 files changed

+878
-88
lines changed

assets/sass/dark-mode.css

+15
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
$search-border: #ceccc5;
2929
$search-focus-border: #007175;
3030

31+
$logos-1: #a6a7a1;
32+
$logos-2: #90908b;
33+
$logos-3: #767675;
34+
$logos-4: #696c69;
35+
3136
@if $mode == dark {
3237
$orange: #d7834f;
3338
$blue: #007a7e;
@@ -56,6 +61,11 @@
5661
$search-border: #5e5e5a;
5762
$search-focus-border: #ceccc5;
5863

64+
$logos-1: #696c69;
65+
$logos-2: #767675;
66+
$logos-3: #90908b;
67+
$logos-4: #a6a7a1;
68+
5969
:root#{$theme} {
6070
div#masthead {
6171
background: transparent;
@@ -181,6 +191,11 @@
181191
--versions-footer-bg-color: #{$versions-footer-bg-color};
182192
--search-border: #{$search-border};
183193
--search-focus-border: #{$search-focus-border};
194+
195+
--logos-1: #{$logos-1};
196+
--logos-2: #{$logos-2};
197+
--logos-3: #{$logos-3};
198+
--logos-4: #{$logos-4};
184199
}
185200
}
186201

assets/sass/front-page.scss

+36-71
Original file line numberDiff line numberDiff line change
@@ -199,91 +199,58 @@ $monitor-height: 271px;
199199
}
200200
}
201201

202+
@property --floor {
203+
syntax: '<integer>';
204+
initial-value: 0;
205+
inherits: false;
206+
}
207+
208+
@property --seed {
209+
syntax: '<integer>';
210+
initial-value: #{random(1000)};
211+
inherits: true;
212+
}
213+
202214
#companies-projects {
203-
padding-top: 20px;
204-
clear: both;
205215
border-top: solid 1px var(--base-border-color);
206216

207217
ul {
208218
@extend .unstyled !optional;
209219

220+
display: grid;
221+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
222+
align-items: center;
223+
justify-items: center;
224+
210225
li {
211-
display: block;
212-
float: left;
213-
width: 108px;
214-
height: 65px;
215-
margin: 0 4px 25px 5px;
226+
margin: 1em 2em;
227+
228+
$num: 11;
229+
$prime: 97;
230+
231+
@for $i from 1 through $num {
232+
&:nth-child(#{$i}) {
233+
--prod: calc(var(--seed) * #{$i} * #{$prime});
234+
--floor: calc((var(--prod) / #{$num}) - 0.5);
235+
236+
order: calc(var(--prod) - (#{$num} * var(--floor)));
237+
}
238+
}
216239
}
217240

218241
a {
219-
display: block;
220-
width: 108px;
221-
height: 65px;
222-
text-indent: -9999px;
223-
background-repeat: no-repeat;
224-
background-position: 0 0;
225242
opacity: 0.85;
226243
transition-duration: 0.3s;
227244
transition-property: opacity;
228245

229246
&:hover {
230247
opacity: 1;
231248
}
249+
}
232250

233-
&.google {
234-
@include background-image-2x($baseurl + "images/company-project-logos/google", 108px, 65px);
235-
}
236-
237-
&.microsoft {
238-
@include background-image-2x($baseurl + "images/company-project-logos/microsoft", 108px, 65px);
239-
}
240-
241-
&.netflix {
242-
@include background-image-2x($baseurl + "images/company-project-logos/netflix", 108px, 65px);
243-
}
244-
245-
&.linked-in {
246-
@include background-image-2x($baseurl + "images/company-project-logos/linked-in", 108px, 65px);
247-
}
248-
249-
&.linux {
250-
@include background-image-2x($baseurl + "images/company-project-logos/linux", 108px, 65px);
251-
}
252-
253-
&.perl {
254-
@include background-image-2x($baseurl + "images/company-project-logos/perl", 108px, 65px);
255-
}
256-
257-
&.postgresql {
258-
@include background-image-2x($baseurl + "images/company-project-logos/postgresql", 108px, 65px);
259-
}
260-
261-
&.android {
262-
@include background-image-2x($baseurl + "images/company-project-logos/android", 108px, 65px);
263-
}
264-
&.rails {
265-
@include background-image-2x($baseurl + "images/company-project-logos/rails", 108px, 65px);
266-
}
267-
268-
&.qt {
269-
@include background-image-2x($baseurl + "images/company-project-logos/qt", 108px, 65px);
270-
}
271-
272-
&.gnome {
273-
@include background-image-2x($baseurl + "images/company-project-logos/gnome", 108px, 65px);
274-
}
275-
276-
&.eclipse {
277-
@include background-image-2x($baseurl + "images/company-project-logos/eclipse", 108px, 65px);
278-
}
279-
280-
&.kde {
281-
@include background-image-2x($baseurl + "images/company-project-logos/kde", 108px, 65px);
282-
}
283-
284-
&.x {
285-
@include background-image-2x($baseurl + "images/company-project-logos/x", 108px, 65px);
286-
}
251+
svg {
252+
max-width: 100%;
253+
max-height: 100%;
287254
}
288255
}
289256
}
@@ -360,12 +327,10 @@ a.icon {
360327
}
361328
#companies-projects {
362329
ul {
363-
display: flex;
364-
flex-wrap: wrap;
365-
justify-content: center;
330+
// TODO
366331
}
367332
li {
368-
margin: 0.7rem 0.4rem;
333+
// TODO
369334
}
370335
}
371336
}

layouts/partials/company-svg.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{/* from https://bitbanged.com/posts/how-to-use-inline-svgs-with-hugo/ */}}
2+
{{/* and https://css-tricks.com/accessible-svgs/ */}}
3+
{{ $svg := . }}
4+
{{ $class := print $svg "-icon" }}
5+
{{ $match := "<svg (.*)?>(.*)</svg>" }}
6+
{{ $replaceWith := printf `<svg class="%s" ${1}>${2}</svg>` $class }}
7+
8+
{{ $source := printf "/static/images/%s.svg" $svg | readFile }}
9+
10+
{{/* The SVGs are created in Inkscape. They all are sourced from: */}}
11+
{{/* static/images/company-project-logos/all.svg */}}
12+
{{/* */}}
13+
{{/* The are exported using the "Batch Export" -> "Layers" function. */}}
14+
{{/* */}}
15+
{{/* Four colors are used in the source drawing. These are replaced */}}
16+
{{/* by CSS variables to accomodate dark mode. */}}
17+
18+
{{ $source = replace $source "#aaaaaa" "var(--logos-1)" }}
19+
{{ $source = replace $source "#999999" "var(--logos-2)" }}
20+
{{ $source = replace $source "#666666" "var(--logos-3)" }}
21+
{{ $source = replace $source "#333333" "var(--logos-4)" }}
22+
23+
{{ return (replaceRE $match $replaceWith $source | safeHTML) }}

layouts/partials/site-root.html

+16-17
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,21 @@ <h3>Community</h3>
5858
</div>
5959

6060
<section id="companies-projects">
61-
<h3 class="text-center"> Companies &amp; Projects Using Git </h3>
61+
<h3 class="text-center">Products providing Git hosting</h3>
6262
<ul>
63-
<li><a href="https://github.com/google" class="google">Google</a></li>
64-
<li><a href="https://github.com/Microsoft" class="microsoft">Microsoft</a></li>
65-
<li><a href="https://github.com/linkedin" class="linked-in">LinkedIn</a></li>
66-
<li><a href="https://github.com/netflix" class="netflix">Netflix</a></li>
67-
<li><a href="https://perl5.git.perl.org/perl.git" class="perl">Perl</a></li>
68-
<li><a href="https://git.postgresql.org/gitweb/" class="postgresql">PostgreSQL</a></li>
69-
70-
<li><a href="https://android-review.googlesource.com/#/q/status:open,n,z" class="android">Android</a></li>
71-
<li><a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git" class="linux">Linux</a></li>
72-
<li><a href="https://github.com/rails/rails" class="rails">Ruby on Rails</a></li>
73-
<li><a href="https://code.qt.io/cgit/" class="qt">Qt</a></li>
74-
<li><a href="https://gitlab.gnome.org/GNOME" class="gnome">Gnome</a></li>
75-
<li><a href="https://git.eclipse.org/c/" class="eclipse">Eclipse</a></li>
76-
<li><a href="https://invent.kde.org/explore/groups" class="kde">KDE</a></li>
77-
<li><a href="https://cgit.freedesktop.org/xorg/xserver/" class="x">X</a></li>
78-
</ul>
63+
{{ $m := slice
64+
(dict "name" "gitlab" "url" "https://gitlab.com")
65+
(dict "name" "github" "url" "https://github.com")
66+
(dict "name" "forgejo" "url" "https://forgejo.org")
67+
(dict "name" "codeberg" "url" "https://codeberg.org")
68+
(dict "name" "sourcehut" "url" "https://sourcehut.org")
69+
(dict "name" "gitea" "url" "https://gitea.com")
70+
}}
71+
{{ range shuffle $m }}
72+
<li><a href="{{ .url }}">{{ partial "company-svg" (printf "company-project-logos/%s" .name) }}</a></li>
73+
{{ end }}
74+
</ul>
75+
<script type="text/javascript">
76+
document.getElementById("companies-projects").style.setProperty("--seed", Math.floor(Math.random() * 1000));
77+
</script>
7978
</section>

0 commit comments

Comments
 (0)