hugo-theme-relearn/layouts/shortcodes/tabs.html
Sören Weber 8551ee2738
shortcodes: revamp shortcodes #260 #261
- supply named parameter if missing #260
- fix boolean parameter if given as string #261
- revise documentation
2022-06-05 19:31:59 +02:00

21 lines
745 B
HTML

{{- with .Inner }}{{/* don't do anything, just call it */}}{{ end }}
{{- $groupId := .Get "groupId" | default "default" }}
<div class="tab-panel">
<div class="tab-nav">
{{- range $idx, $tab := .Scratch.Get "tabs" }}
<button
data-tab-item="{{ .name }}"
data-tab-group="{{ $groupId }}"
class="tab-nav-button {{ cond (eq $idx 0) "active" ""}}"
onclick="switchTab('{{ $groupId }}','{{ .name }}')"
><span>{{ .name }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := .Scratch.Get "tabs" }}
<div data-tab-item="{{ .name }}" data-tab-group="{{ $groupId }}" class="tab-item {{ cond (eq $idx 0) "active" ""}}">
{{ .content }}
</div>
{{- end }}
</div>
</div>