Skip to content

Commit 174816f

Browse files
Use grid of cards for team gallery (#510)
1 parent abc3a6a commit 174816f

5 files changed

Lines changed: 60 additions & 93 deletions

File tree

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
.DEFAULT_GOAL := doc-serve
33

44
GH_ORG = scientific-python
5-
TEAMS_DIR = doc/static/teams
5+
TEAMS_DIR = doc/content/about
66
TEAMS = theme-team
77
TEAMS_QUERY = python tools/team_query.py
88

99
$(TEAMS_DIR):
1010
mkdir -p $(TEAMS_DIR)
1111

12-
$(TEAMS_DIR)/%.md: $(TEAMS_DIR)
12+
$(TEAMS_DIR)/%.toml: $(TEAMS_DIR)
1313
$(eval TEAM_NAME=$(shell python -c "import re; print(' '.join(x.capitalize() for x in re.split('-|_', '$*')))"))
14-
$(TEAMS_QUERY) --org $(GH_ORG) --team "$*" > $(TEAMS_DIR)/$*.html
14+
$(TEAMS_QUERY) --org $(GH_ORG) --team "$*" > $(TEAMS_DIR)/$*.toml
1515

1616
teams-clean:
1717
for team in $(TEAMS); do \
18-
rm -f $(TEAMS_DIR)/$${team}.html ;\
18+
rm -f $(TEAMS_DIR)/$${team}.toml ;\
1919
done
2020

21-
teams: | teams-clean $(patsubst %,$(TEAMS_DIR)/%.md,$(TEAMS))
21+
teams: | teams-clean $(patsubst %,$(TEAMS_DIR)/%.toml,$(TEAMS))
2222

2323
doc/content/shortcodes.md: $(wildcard layouts/shortcodes/*.html)
2424
(cd layouts && python ../tools/render_shortcode_docs.py > ../doc/content/shortcodes.md)

doc/content/about/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ The **Scientific Python Hugo Theme** is a theme for the
77
[Hugo](https://gohugo.io) static site generator built on the
88
[Fresh](https://github.com/StefMa/hugo-fresh) theme.
99

10-
{{< include-html "static/teams/theme-team.html" >}}
10+
{{< grid1 file="theme-team.toml" columns="2 3 4 5" />}}

doc/content/about/theme-team.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[[item]]
2+
type = 'card'
3+
header = 'Adam Porter'
4+
body = '''{{< image >}}
5+
src = 'https://avatars.githubusercontent.com/u/601365?v=4"'
6+
alt = 'Avatar of Adam Porter'
7+
{{< /image >}}'''
8+
link = 'https://github.com/alphapapa'
9+
10+
[[item]]
11+
type = 'card'
12+
header = 'Brian Hawthorne'
13+
body = '''{{< image >}}
14+
src = 'https://avatars.githubusercontent.com/u/352264?u=1fd523aa28b0451454989400579d97a8c1bc1b9a&v=4"'
15+
alt = 'Avatar of Brian Hawthorne'
16+
{{< /image >}}'''
17+
link = 'https://github.com/brianhawthorne'
18+
19+
[[item]]
20+
type = 'card'
21+
header = 'Jarrod Millman'
22+
body = '''{{< image >}}
23+
src = 'https://avatars.githubusercontent.com/u/123428?v=4"'
24+
alt = 'Avatar of Jarrod Millman'
25+
{{< /image >}}'''
26+
link = 'https://github.com/jarrodmillman'
27+
28+
[[item]]
29+
type = 'card'
30+
header = 'Stefan van der Walt'
31+
body = '''{{< image >}}
32+
src = 'https://avatars.githubusercontent.com/u/45071?u=c779b5e06448fbc638bc987cdfe305c7f9a7175e&v=4"'
33+
alt = 'Avatar of Stefan van der Walt'
34+
{{< /image >}}'''
35+
link = 'https://github.com/stefanv'
36+
37+
[[item]]
38+
type = 'card'
39+
header = 'Pamphile Roy'
40+
body = '''{{< image >}}
41+
src = 'https://avatars.githubusercontent.com/u/23188539?u=64445b52dbf3f75de8006ed4264fdd2afaed97a3&v=4"'
42+
alt = 'Avatar of Pamphile Roy'
43+
{{< /image >}}'''
44+
link = 'https://github.com/tupui'

doc/static/teams/theme-team.html

Lines changed: 0 additions & 61 deletions
This file was deleted.

tools/team_query.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,38 +61,22 @@ def api(query):
6161
members = resp["data"]["organization"]["team"]["members"]["nodes"]
6262
team_name = resp["data"]["organization"]["team"]["name"]
6363

64-
team_template = string.Template(
65-
"""\
66-
<div class="team">
67-
<h3 id="${team}" class="team-name">${team_name}</h3>
68-
<div class="team-members">
69-
${members}
70-
</div>
71-
</div>"""
72-
)
73-
7464
member_template = string.Template(
7565
"""\
76-
<div class="team-member">
77-
<a href="${url}" class="team-member-name">
78-
<div class="team-member-photo">
79-
<img
80-
src="${avatarUrl}"
81-
loading="lazy"
82-
alt="Avatar of ${name}"
83-
/>
84-
</div>
85-
${name}
86-
</a>
87-
</div>"""
66+
[[item]]
67+
type = 'card'
68+
header = '${name}'
69+
body = '''{{< image >}}
70+
src = '${avatarUrl}"'
71+
alt = 'Avatar of ${name}'
72+
{{< /image >}}'''
73+
link = '${url}'
74+
"""
8875
)
8976

9077
members_list = []
9178
for m in members:
9279
m["name"] = m["name"] or m["login"]
9380
members_list.append(member_template.substitute(**m))
9481

95-
members_str = "".join(members_list)
96-
team_str = team_template.substitute(members=members_str, team=team, team_name=team_name)
97-
98-
print(team_str)
82+
print("\n".join(members_list).rstrip())

0 commit comments

Comments
 (0)