36 lines
1.9 KiB
HTML
36 lines
1.9 KiB
HTML
{{ $_hugo_config := `{ "version": 1 }` }}
|
|
|
|
{{/*
|
|
Parameters:
|
|
- type (string, verplicht/nuttig): bepaalt CSS-class, bijv: "added", "changed", "security"
|
|
- label (string, optioneel): tekst in de badge; default = type | title-case
|
|
- title (string, optioneel): tekst naast de badge als header; default = label
|
|
- open (string, optioneel): "true" of "false" -> standaard dicht, "true" = start open
|
|
- class (string, optioneel): extra class op .accordion
|
|
- header-class (string, optioneel): extra class op header button
|
|
- body-class (string, optioneel): extra class op content
|
|
*/}}
|
|
|
|
{{ $type := .Get "type" | default (.Get 0) }}
|
|
{{ $label := .Get "label" | default ($type | title) }}
|
|
{{ $title := .Get "title" | default $label }}
|
|
{{ $openParam := .Get "open" | default "false" }}
|
|
{{ $class := .Get "class" }}
|
|
{{ $headerClass := .Get "header-class" }}
|
|
{{ $bodyClass := .Get "body-class" }}
|
|
|
|
{{ $isOpen := eq (lower $openParam) "true" }}
|
|
|
|
<div class="accordion mt-4 {{ $class }}">
|
|
<button class="accordion-header {{ $headerClass }}" data-accordion {{ if $isOpen }}aria-expanded="true"{{ end }}>
|
|
<div class="badge d-inline-block rounded-1 {{ $type | lower }}">{{ $label | markdownify }}</div>
|
|
<span class="accordion-title">{{ $title | markdownify }}</span>
|
|
<svg class="accordion-icon" x="0px" y="0px" viewBox="0 0 512 512" xmlspace="preserve">
|
|
<path fill="currentColor" d="M505.755,123.592c-8.341-8.341-21.824-8.341-30.165,0L256.005,343.176L36.421,123.592c-8.341-8.341-21.824-8.341-30.165,0 s-8.341,21.824,0,30.165l234.667,234.667c4.16,4.16,9.621,6.251,15.083,6.251c5.462,0,10.923-2.091,15.083-6.251l234.667-234.667 C514.096,145.416,514.096,131.933,505.755,123.592z"></path>
|
|
</svg>
|
|
</button>
|
|
<div class="accordion-content {{ $bodyClass }}{{ if $isOpen }} is-open{{ end }}">
|
|
{{ .Inner | markdownify }}
|
|
</div>
|
|
</div>
|