Skip to content

Commit 8c4d8ac

Browse files
committed
Add Subscribers page
1 parent 4f0bc99 commit 8c4d8ac

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
16.8 KB
Loading
3.59 KB
Loading
11.2 KB
Loading

subscribers.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
layout: feature
3+
title: "Supporters"
4+
page-class: page--blog page--supporters
5+
meta: ""
6+
main: ""
7+
permalink: /supporters/
8+
lux: "Supporters"
9+
supporters:
10+
- name: Joan Leon
11+
url: https://www.nucliweb.net/
12+
avatar: joan-leon.jpg
13+
tier: insider
14+
- name: alessioalex
15+
url: https://github.com/alessioalex
16+
avatar: alessioalex.jpeg
17+
tier: subscriber
18+
- name: Dogwonder Ltd
19+
url: https://richholman.com
20+
avatar: dogwonder.png
21+
tier: supporter
22+
---
23+
24+
<style>
25+
26+
.c-list-supporters {
27+
list-style: none;
28+
margin-left: 0;
29+
display: grid;
30+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
31+
gap: 1.5rem;
32+
align-items: center;
33+
}
34+
35+
.c-list-supporters__item {
36+
display: flex;
37+
align-items: center;
38+
width: 100%;
39+
position: relative;
40+
}
41+
42+
.c-list-supporters__item::before {
43+
content: var(--tier);
44+
position: absolute;
45+
top: 0;
46+
left: 0;
47+
transform: translate(-50%, -50%);
48+
font-size: 1.5rem;
49+
line-height: 1;
50+
width: 1em;
51+
background-color: #f9f9f9;
52+
border-radius: 100%;
53+
}
54+
55+
.c-list-supporters__link {
56+
text-decoration: none;
57+
display: flex;
58+
align-items: center;
59+
width: 100%;
60+
gap: 0.75rem;
61+
}
62+
63+
.c-list-supporters__avatar {
64+
border-radius: 50%;
65+
flex-shrink: 0;
66+
width: 3rem;
67+
height: 3rem;
68+
object-fit: cover;
69+
}
70+
71+
</style>
72+
73+
These wonderful people support CSS Wizardry.
74+
75+
<a href="https://csswizardry.gumroad.com/l/subscribe" class="btn btn--positive"><b>Become a Supporter</b></a>
76+
or
77+
<button class="btn btn--small" id="jsRandomiseSupporters">Randomise Supporters</button>
78+
79+
- - -
80+
81+
{% assign shuffled = page.supporters | sample: page.supporters.size %}
82+
<ul id="jsSupportersList" class="c-list-supporters">
83+
84+
{% for person in page.supporters %}
85+
<li class="c-list-supporters__item" style="
86+
{% case person.tier %}
87+
{% when 'supporter' %}
88+
--tier: '☕️';
89+
{% when 'subscriber' %}
90+
--tier: '🧑‍💻';
91+
{% when 'insider' %}
92+
--tier: '🗝️';
93+
{% when 'seeker' %}
94+
--tier: '🔮';
95+
{% else %}
96+
--tier: '🤝';
97+
{% endcase %}
98+
">
99+
<a href="{{ person.url }}" class="c-list-supporters__link">
100+
<img
101+
src="/img/content/subscribers/{{ person.avatar }}"
102+
alt="{{ person.name }}’s avatar"
103+
width="48"
104+
height="48"
105+
class="c-list-supporters__avatar"
106+
>
107+
{{ person.name }}
108+
</a>
109+
</li>
110+
{% endfor %}
111+
112+
</ul>
113+
114+
<script>
115+
(() => {
116+
117+
function randomiseSupporters() {
118+
const list = document.getElementById('jsSupportersList');
119+
const items = Array.from(list.children);
120+
121+
for (let i = items.length - 1; i > 0; i--) {
122+
const j = Math.floor(Math.random() * (i + 1));
123+
[items[i], items[j]] = [items[j], items[i]];
124+
}
125+
126+
items.forEach(item => list.appendChild(item));
127+
}
128+
129+
randomiseSupporters();
130+
document.getElementById('jsRandomiseSupporters')
131+
.addEventListener('click', randomiseSupporters);
132+
133+
})();
134+
</script>

0 commit comments

Comments
 (0)