hugo-theme-relearn/layouts/partials/shortcodes/tabs.html
2023-05-25 13:17:16 +02:00

26 lines
No EOL
1,017 B
HTML

{{- $context := .context }}
{{- $tabs := .content | default slice }}
{{- $groupid := .groupid | default (partial "make-random-md5.hugo" $context) }}
{{- with $context }}
<div class="tab-panel" data-tab-group="{{ $groupid }}">
<div class="tab-nav">
{{- range $idx, $tab := $tabs }}
<button
data-tab-item="{{ .name | markdownify | plainify }}"
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
onclick="switchTab('{{ $groupid }}','{{ .name | markdownify | plainify}}')"
>
<span>{{ .name | markdownify }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := $tabs }}
<div
data-tab-item="{{ .name | markdownify | plainify }}"
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
>
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
{{- end }}
</div>
</div>
{{- end }}