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

24 lines
799 B
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" "badge" "args" .Params) }}
{{ errorf "Invalid arguments: %s" .Position -}}
{{ $error = true }}
{{ end }}
<!-- Initialize arguments -->
{{- $title := .Get "title" | default "" -}}
{{- $class := .Get "class" | default "" -}}
{{- $color := .Get "color" | default "secondary" -}}
<!-- Main code -->
{{- if not $error }}
<span class="badge text-bg-{{ $color }}{{ with $class }} {{ . }}{{ end }}">{{ $title | plainify }}</span>
{{ end -}}