Skip to content

Commit 9f8eca2

Browse files
committed
feat: add stepper graphic for article series
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 4e9c179 commit 9f8eca2

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

layouts/_default/single.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
{{ with .Title }}
99
<h1 data-pagefind-weight="10" class="scroll-mt-36">{{ . }}</h1>
1010
{{ end }}
11+
{{ if eq .CurrentSection.Layout "series" }}
12+
{{ partial "guides-stepper.html" . }}
13+
{{ end }}
1114
<div class="block lg:hidden">
1215
{{ partial "pagemeta.html" . }}
1316
<hr>

layouts/partials/guides-stepper.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{ if or .NextInSection .PrevInSection }}
2+
<a
3+
class="no-underline my-8 flex justify-center text-xs text-white"
4+
href="{{ .CurrentSection.Permalink }}">
5+
<span class="rounded-l bg-blue-light-400 px-2 dark:bg-blue-dark-500">SERIES</span>
6+
<span class="rounded-r bg-blue-light-500 px-2 dark:bg-blue-dark-400">{{ .CurrentSection.Title }}</span>
7+
</a>
8+
<div x-data class="mb-8 flex w-full items-center justify-center gap-1 px-8 text-center text-sm md:px-20">
9+
{{ page.Store.Set "stepper_seen" false }}
10+
{{ range $i, $e := .CurrentSection.Pages }}
11+
{{ if $i }}
12+
{{ if (page.Store.Get "stepper_seen") }}
13+
<div class="flex-grow border-b-2 border-b-gray-light-400 dark:border-b-gray-dark-400"></div>
14+
{{ else }}
15+
<div class="flex-grow border-b-2 border-b-green-light-400 dark:border-b-green-dark-400"></div>
16+
{{ end }}
17+
{{ end }}
18+
<a href="{{ .Permalink }}" class="no-underline text-white flex items-center justify-center w-8 h-8 rounded-full
19+
{{ if (page.Store.Get "stepper_seen") }}
20+
bg-gray-light-400 dark:bg-gray-dark-400
21+
{{ else if (eq . page) }}
22+
{{ .Store.Set "stepper_seen" true }}
23+
bg-blue-light-400 dark:bg-blue-dark-400
24+
{{ else }}
25+
bg-green-light-400 dark:bg-green-dark-400
26+
{{ end }}">
27+
{{ add $i 1 }}</a>
28+
{{ end }}
29+
</div>
30+
{{ end }}

0 commit comments

Comments
 (0)