diff --git a/modules/blox/layouts/_partials/functions/parse_block_v3.html b/modules/blox/layouts/_partials/functions/parse_block_v3.html index f784c646..9d53f186 100644 --- a/modules/blox/layouts/_partials/functions/parse_block_v3.html +++ b/modules/blox/layouts/_partials/functions/parse_block_v3.html @@ -281,19 +281,31 @@ {{ $style = printf "%sclip-path: %s;" $style . }} {{ end }} -{{/* Section break: mask-image fade for smooth transitions between sections */}} +{{/* Section break: smooth transitions between sibling sections via gradient + overlay divs at the section's top/bottom edges. Each edge fades from + transparent (toward the section's content) to a user-specified colour + (matching the adjacent sibling's background). + + Example — hero fading into a dark logos band beneath: + section_break: + fade_bottom: "#101828" # any CSS colour (hex, rgb, var, named) + fade_top: "#0a0e27" # optional, independent of fade_bottom + size: "6rem" # optional, default 6rem (applies to both edges) + + Why explicit colour: a gradient overlay needs to know what colour to fade + INTO. Hugo can't reliably auto-detect the next sibling's background at + parse time, so the user declares intent. */}} +{{ $break_overlay := "" }} {{ with $block.design.section_break }} - {{ $mask := "" }} - {{ if eq . "fade-top" }} - {{ $mask = "linear-gradient(to bottom, transparent 0%, black 6rem, black 100%)" }} - {{ else if eq . "fade-bottom" }} - {{ $mask = "linear-gradient(to bottom, black 0%, black calc(100% - 6rem), transparent 100%)" }} - {{ else if eq . "fade-both" }} - {{ $mask = "linear-gradient(to bottom, transparent 0%, black 6rem, black calc(100% - 6rem), transparent 100%)" }} + {{ $sb_size := .size | default "6rem" }} + {{ $overlays := slice }} + {{ with .fade_bottom }} + {{ $overlays = $overlays | append (printf "
" $sb_size .) }} {{ end }} - {{ with $mask }} - {{ $style = printf "%s-webkit-mask-image: %s; mask-image: %s;" $style . . }} + {{ with .fade_top }} + {{ $overlays = $overlays | append (printf "" $sb_size .) }} {{ end }} + {{ $break_overlay = delimit $overlays "" }} {{ end }} {{ $hash_id := $block.id | default (printf "section-%s" (replace $block_type "." "-")) }} @@ -312,6 +324,8 @@