Files
hinode/layouts/shortcodes/spinner.html
2024-01-01 12:32:39 +01:00

28 lines
1.0 KiB
HTML

<!--
Copyright © 2024 The Hinode Team / Mark Dumay. All rights reserved.
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
Visit gethinode.com/license for more details.
-->
{{ $error := false }}
<!-- Validate arguments -->
{{ if partial "utilities/IsInvalidArgs.html" (dict "structure" "spinner" "args" .Params) }}
{{ errorf "Invalid arguments: %s" .Position -}}
{{ $error = true }}
{{ end }}
<!-- Initialize arguments -->
{{ $color := .Get "color" | default "primary" -}}
{{ $grow := false -}}
{{ with .Get "grow" }}{{ $grow = partial "utilities/CastBool.html" . }}{{ end -}}
{{ $class := .Get "class" | default "" -}}
<!-- Main code -->
{{ if not $error }}
{{ with $class }}<div class="{{ . }}">{{ end }}
<div class="spinner-{{ if $grow }}grow{{ else }}border{{ end }} text-{{ $color }}" role="status">
<span class="visually-hidden">{{ trim .Inner " \r\n" | plainify -}}</span>
</div>
{{ if $class }}</div>{{ end }}
{{ end }}