Omphaloskepsis-2/layouts/shortcodes/button.html

34 lines
858 B
HTML
Raw Permalink Normal View History

2024-07-23 08:08:36 +00:00
{{- /*
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>