trwnh.com/unified.test.hugo/layouts/partials/components/admonition.html

28 lines
1.7 KiB
HTML
Raw Normal View History

{{- $type := or .type "note" }}
{{- $title := .title }}
{{- $text := .text }}
{{ "<!-- alert block -->" | safeHTML }}
<aside class="admonition"{{ with $type }} data-type="{{.}}"{{end}}>
<header class="admonition-header">
{{- if in (slice "info" "note" "tip" "hint") $type }}
<svg class="admonition__icon info-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><title>info</title><path fill="currentColor" d="M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"/></svg>
{{- end -}}
{{- if in (slice "warning" "caution" "alert" "notice" "warn") $type }}
<svg class="admonition__icon warning-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><title>warning</title><path fill="currentColor" d="M1 21L12 2l11 19zm11-3q.425 0 .713-.288T13 17t-.288-.712T12 16t-.712.288T11 17t.288.713T12 18m-1-3h2v-5h-2z"/></svg>
{{- end }}
{{- if in (slice "danger" "important") $type}}
<svg class="admonition__icon danger-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 12 12"><title>danger</title><path fill="currentColor" d="M4.283 2.98a1.735 1.735 0 1 1 3.434 0l-.576 4.03a1.153 1.153 0 0 1-2.282 0zM7 10a1 1 0 1 1-2 0a1 1 0 0 1 2 0"/></svg>
{{- end -}}
{{- with $title }}
<p class="admonition__title" aria-hidden="true">{{.}}</p>
{{- end }}
</header>
{{- with $text }}
<div class="admonition__text">
{{ . }}
</div>
{{- end }}
</aside>
{{ "<!-- end alert block -->" | safeHTML }}