Omphaloskepsis-2/layouts/shortcodes/button.html
2024-07-23 10:08:36 +02:00

33 lines
858 B
HTML

{{- /*
Renders a button, or no-JS fallback.
@params id ID for button.
@params label Label text for button.
@params text Text for button.
*/ -}}
<!-- Validation -->
{{- if ( not ( isset .Params "id" ) ) -}}
{{- errorf "No ID set for button (%q)" .Page.File.Path -}}
{{- end -}}
{{- if ( not ( isset .Params "label" ) ) -}}
{{- errorf "No label set for button '%q' (%q)" .Params.id .Page.File.Path -}}
{{- end -}}
{{- if ( not ( isset .Params "text" ) ) -}}
{{- errorf "No text set for button '%q' (%q)" .Params.id .Page.File.Path -}}
{{- end -}}
<!-- Rendering -->
<noscript>You must have JavaScript enabled to interact with this button.</noscript>
<label class="label label--button">
{{- .Params.label -}}:
<button id="{{- .Params.id -}}" class="button">
{{- .Params.text -}}
</button>
</label>