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

26 lines
1,017 B
HTML
Raw Normal View History

{{- $context := .context }}
{{- $tabs := .content | default slice }}
{{- $groupid := .groupid | default (partial "make-random-md5.hugo" $context) }}
{{- with $context }}
2023-01-29 15:45:42 +00:00
<div class="tab-panel" data-tab-group="{{ $groupid }}">
<div class="tab-nav">
{{- range $idx, $tab := $tabs }}
<button
2023-05-25 11:17:16 +00:00
data-tab-item="{{ .name | markdownify | plainify }}"
class="tab-nav-button{{ cond (eq $idx 0) " active" ""}}"
2023-05-25 11:17:16 +00:00
onclick="switchTab('{{ $groupid }}','{{ .name | markdownify | plainify}}')"
2023-01-29 15:45:42 +00:00
>
2023-05-25 11:17:16 +00:00
<span>{{ .name | markdownify }}</span></button>
{{- end }}
</div>
<div class="tab-content">
{{- range $idx, $tab := $tabs }}
2023-01-29 15:45:42 +00:00
<div
2023-05-25 11:17:16 +00:00
data-tab-item="{{ .name | markdownify | plainify }}"
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
2023-01-29 15:45:42 +00:00
>
{{ .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 }}