hugo-book-theme/layouts/shortcodes/tabs.html

34 lines
1 KiB
HTML
Raw Normal View History

2019-05-22 14:37:31 +02:00
{{ if .Inner }}{{ end }}
{{ $id := .Get 0 }}
{{ $group := printf "tabs-%s" $id }}
2019-05-23 17:48:30 +02:00
<!--
2019-05-22 14:37:31 +02:00
<div class="book-tabs">
<div class="book-tabs-head">
2019-05-23 17:48:30 +02:00
{{ range $index, $tab := .Scratch.Get $group }}
2019-05-22 14:37:31 +02:00
<label for="{{ printf "%s-%d" $group $index }}">
2019-05-23 17:48:30 +02:00
{{ $tab.Name }}
2019-05-22 14:37:31 +02:00
</label>
{{ end }}
</div>
2019-05-23 17:48:30 +02:00
{{ range $index, $tab := .Scratch.Get $group }}
2019-05-22 14:37:31 +02:00
<input type="radio" name="{{ $group }}" style="display: none;" id="{{ printf "%s-%d" $group $index }}" {{ if not $index }}checked="checked"{{ end }} />
2019-05-23 17:48:30 +02:00
<div class="book-tabs-content book-tabs-{{ $index }} markdown-inner">
{{ .Content | markdownify }}
2019-05-22 14:37:31 +02:00
</div>
{{ end }}
</div>
2019-05-23 17:48:30 +02:00
-->
<div class="book-tabs">
{{ range $index, $tab := .Scratch.Get $group }}
<input type="radio" name="{{ $group }}" style="display: none;" id="{{ printf "%s-%d" $group $index }}" {{ if not $index }}checked="checked"{{ end }} />
<label for="{{ printf "%s-%d" $group $index }}">
{{ $tab.Name }}
</label>
<div class="book-tabs-content markdown-inner">
{{ .Content | markdownify }}
</div>
{{ end }}
</div>