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

24 lines
970 B
HTML
Raw Normal View History

{{- $context := .context }}
{{- $content := .content }}
{{- $title := .title | default (T "Expand-title") }}
2022-12-01 00:37:09 +00:00
{{- $title = trim $title " " }}
{{- $expanded := .open | default false }}
{{- if eq (printf "%T" $expanded) "string" }}
{{- $expanded = (eq $expanded "true") }}
{{- end }}
2022-11-01 01:00:50 +00:00
{{- $direction := T "Reading-direction" | default "ltr" }}
{{- with $context }}
{{- $id := partial "make-random-md5.hugo" }}
<div class="expand">
<input type="checkbox" id="expand-{{ $id }}" aria-controls="expandcontent-{{ $id }}" {{ if $expanded }} checked{{ end }}>
<label class="expand-label" for="expand-{{ $id }}" >
<i class="fas fa-chevron-down"></i>
2022-11-01 01:00:50 +00:00
<i class="fas fa-chevron-left expand-rtl direction-{{ $direction }}"></i>
<i class="fas fa-chevron-right expand-ltr direction-{{ $direction }}"></i>
{{ $title }}
</label>
<div id="expandcontent-{{ $id }}" class="expand-content">
{{ $content | safeHTML }}
</div>
</div>
{{- end }}