21 lines
1.2 KiB
HTML
21 lines
1.2 KiB
HTML
{{/*
|
|
Buttons. `primary` is the solid blue button with a leading arrow tile,
|
|
`ghost` the pale blue secondary with corner ticks, `text` a quiet link
|
|
with an arrow. Any trailing "→" in a label is dropped — the arrow is drawn.
|
|
*/}}
|
|
{{ range . }}
|
|
{{ $label := replaceRE `\s*[→↗]\s*$` "" .label }}
|
|
{{ $external := or (hasPrefix .url "http") (hasPrefix .url "mailto:") }}
|
|
{{ $href := cond (or $external (hasPrefix .url "#")) .url (.url | relURL) }}
|
|
{{ if eq .style "ghost" }}
|
|
<a href="{{ $href }}" class="btn btn-secondary">{{ $label }}<span class="arrow" aria-hidden="true">{{ if $external }}↗{{ else }}→{{ end }}</span></a>
|
|
{{ else if eq .style "text" }}
|
|
<a href="{{ $href }}" class="more">{{ $label }}<span class="arrow" aria-hidden="true">{{ if $external }}↗{{ else }}→{{ end }}</span></a>
|
|
{{ else }}
|
|
<a href="{{ $href }}" class="btn btn-primary">
|
|
<span class="btn-tile" aria-hidden="true"><svg viewBox="0 0 16 16" width="14" height="14" fill="none"><path d="M3 8h9M8.5 4.5 12 8l-3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"/></svg></span>
|
|
<span class="btn-label">{{ $label }}</span>
|
|
</a>
|
|
{{ end }}
|
|
{{ end }}
|