mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 06:14:48 +00:00
Wire .hbb-section to var(--hb-spacing-section) instead of hardcoded 6rem, enabling hugoblox.layout.spacing (compact/comfortable/spacious) to take effect. - Default to "spacious" (6rem) to preserve existing visual layouts - Per-section override via design.spacing.padding still works (inline > class) - Remove dead design.spacing frontmatter field from all templates - Set correct layout.spacing token in each template's params.yaml Closes #3314
57 lines
1.8 KiB
HTML
57 lines
1.8 KiB
HTML
{{/*
|
|
HugoBlox Theme Engine: Layout Tokens
|
|
|
|
Resolves layout design tokens (radius, spacing) from the theme config
|
|
and emits them as CSS custom properties.
|
|
|
|
Input: Theme config dict from get_theme_config:
|
|
- layout: { radius, spacing }
|
|
|
|
Output: <style> (CSS custom properties for --hb-radius, --hb-spacing-*)
|
|
*/}}
|
|
|
|
{{/* Map radius tokens to CSS values */}}
|
|
{{ $radius := .layout.radius | default "md" }}
|
|
{{ $radius_value := "0.5rem" }}
|
|
{{ if eq $radius "none" }}
|
|
{{ $radius_value = "0" }}
|
|
{{ else if eq $radius "sm" }}
|
|
{{ $radius_value = "0.25rem" }}
|
|
{{ else if eq $radius "md" }}
|
|
{{ $radius_value = "0.5rem" }}
|
|
{{ else if eq $radius "lg" }}
|
|
{{ $radius_value = "0.75rem" }}
|
|
{{ else if eq $radius "full" }}
|
|
{{ $radius_value = "9999px" }}
|
|
{{ else }}
|
|
{{ warnf "LAYOUT TOKEN WARNING: Unknown radius value '%s'. Expected: none | sm | md | lg | full. Falling back to 'md' (0.5rem)." $radius }}
|
|
{{ end }}
|
|
|
|
{{/* Map spacing tokens to CSS values */}}
|
|
{{ $spacing := .layout.spacing | default "spacious" }}
|
|
{{ $spacing_base := "1.25rem" }}
|
|
{{ $spacing_section := "6rem" }}
|
|
{{ if eq $spacing "compact" }}
|
|
{{ $spacing_base = "0.75rem" }}
|
|
{{ $spacing_section = "2.5rem" }}
|
|
{{ else if eq $spacing "comfortable" }}
|
|
{{ $spacing_base = "1rem" }}
|
|
{{ $spacing_section = "4rem" }}
|
|
{{ else if eq $spacing "spacious" }}
|
|
{{ $spacing_base = "1.25rem" }}
|
|
{{ $spacing_section = "6rem" }}
|
|
{{ else }}
|
|
{{ warnf "LAYOUT TOKEN WARNING: Unknown spacing value '%s'. Expected: compact | comfortable | spacious. Falling back to 'spacious'." $spacing }}
|
|
{{ end }}
|
|
|
|
<style>
|
|
:root {
|
|
/* Layout — Border Radius */
|
|
--hb-radius: {{ $radius_value | safeCSS }};
|
|
|
|
/* Layout — Spacing */
|
|
--hb-spacing-base: {{ $spacing_base | safeCSS }};
|
|
--hb-spacing-section: {{ $spacing_section | safeCSS }};
|
|
}
|
|
</style>
|