mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 18:15:31 +00:00
Also, refactor icon resolution to avoid duplicated logic: get_icon_svg.html New shared core — alias resolution, pack lookup, hb fallback, user assets, hugo fallback. Returns raw SVG string. get_icon.html Thin wrapper — emoji handling, calls get_icon_svg, Unicode emoji fallback for bare names, attribute injection, safeHTML return. get_icon_data.html Thin wrapper — one-liner delegating to get_icon_svg.
15 lines
504 B
HTML
15 lines
504 B
HTML
{{/* Return raw SVG content for Preact component consumption.
|
|
Thin wrapper around get_icon_svg.html — see that partial for resolution logic.
|
|
|
|
USAGE:
|
|
{{ $svg := partial "functions/get_icon_data" (dict "name" "hero/arrow-right") }}
|
|
Then pass $svg as a prop to a Preact component.
|
|
*/}}
|
|
|
|
{{- $name := .name | default "" -}}
|
|
{{- $icon := "" -}}
|
|
{{- if $name -}}
|
|
{{- $icon = partial "functions/get_icon_svg" (dict "name" $name "pack" (.pack | default "")) -}}
|
|
{{- end -}}
|
|
{{- $icon -}}
|