hugo-theme-relearn/layouts/partials/shortcodes/tabs.html

25 lines
836 B
HTML
Raw Normal View History

{{- $context := .context }}
{{- $tabs := .tabs | default slice }}
2022-06-23 11:24:54 +00:00
{{- $groupid := .groupid | default "default" }}
2022-11-01 01:00:50 +00:00
{{- $direction := T "Reading-direction" | default "ltr" }}
{{- with $context }}
<div class="tab-panel">
<div class="tab-nav">
{{- range $idx, $tab := $tabs }}
<button
data-tab-item="{{ .name }}"
2022-06-23 11:24:54 +00:00
data-tab-group="{{ $groupid }}"
2022-11-01 01:00:50 +00:00
class="tab-nav-button direction-{{ $direction }} {{ cond (eq $idx 0) "active" ""}}"
2022-06-23 11:24:54 +00:00
onclick="switchTab('{{ $groupid }}','{{ .name }}')"
><span>{{ .name }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := $tabs }}
2022-06-23 11:24:54 +00:00
<div data-tab-item="{{ .name }}" data-tab-group="{{ $groupid }}" class="tab-item {{ cond (eq $idx 0) "active" ""}}">
{{ .content | safeHTML }}
</div>
{{- end }}
</div>
</div>
{{- end }}