mirror of
https://github.com/13hannes11/hugo-coder-timeline.git
synced 2024-09-04 00:50:58 +02:00
HTML/CSS only tabs (#678)
* Fix pre tag margin top so it looks good inside containers * Bind to 0.0.0.0 for docker container support * Add HTML only tabs shortcode
This commit is contained in:
committed by
GitHub
parent
9ea82c5c82
commit
5e4e500cdf
17
layouts/shortcodes/tab.html
Normal file
17
layouts/shortcodes/tab.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }}
|
||||
{{ $index := .Page.Scratch.Get "tabElementIndex" | default 0 }}
|
||||
{{ $name := .Get "name" | default "Name Me!" }}
|
||||
|
||||
<style>
|
||||
.tabs input#tab-{{ $group }}-{{ $index }}:checked ~ .tab-content-{{ $group }}-{{ $index }} {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<input type="radio" class="tab-input" name="tab-select-{{ $group }}" id="tab-{{ $group }}-{{ $index }}" {{ if eq $index 0 }}checked{{ end }}/>
|
||||
<label for="tab-{{ $group }}-{{ $index }}" class="tab-label">{{ $name }}</label>
|
||||
<div class="tab-content tab-content-{{ $group }}-{{ $index }}">
|
||||
{{ .Inner | markdownify }}
|
||||
</div>
|
||||
|
||||
{{ .Page.Scratch.Set "tabElementIndex" (add 1 $index) }}
|
||||
10
layouts/shortcodes/tabgroup.html
Normal file
10
layouts/shortcodes/tabgroup.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ $align := .Get "align" | default "left" }}
|
||||
{{ $style := .Get "style" | default "markdown" }}
|
||||
{{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }}
|
||||
{{ $index := .Page.Scratch.Set "tabElementIndex" 0 }}
|
||||
|
||||
<div class="tabs {{ if eq $style "code" }}tabs-code {{ end }}tabs-{{ $align }}">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
|
||||
{{ .Page.Scratch.Set "tabGroupIndex" (add 1 $group) }}
|
||||
Reference in New Issue
Block a user