package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // SchematicHeroBlockMeta defines metadata for the landing hero. var SchematicHeroBlockMeta = blocks.BlockMeta{ Key: "schematic_hero", Title: "Schematic Hero", Description: "Landing hero with a large display title over a blueprint image and dual CTAs.", Source: "scifi-clean", Category: blocks.CategoryLayout, } // SchematicCTA is a single call-to-action link. type SchematicCTA struct { Text string Href string } // SchematicHeroData drives the templ render. type SchematicHeroData struct { Title string Kicker string Image string PrimaryCTA SchematicCTA SecondaryCTA SchematicCTA } // SchematicHeroBlock renders the landing hero. // Content shape: {"title": "...", "kicker": "...", "image": "media:...", // "primaryCta": {"text": "...", "href": "..."}, // "secondaryCta": {"text": "...", "href": "..."}} func SchematicHeroBlock(ctx context.Context, content map[string]any) string { data := SchematicHeroData{ Title: getString(content, "title"), Kicker: getString(content, "kicker"), Image: blocks.ResolveMediaPath(getString(content, "image")), } if m := getMap(content, "primaryCta"); m != nil { data.PrimaryCTA = SchematicCTA{Text: getString(m, "text"), Href: getString(m, "href")} } if m := getMap(content, "secondaryCta"); m != nil { data.SecondaryCTA = SchematicCTA{Text: getString(m, "text"), Href: getString(m, "href")} } var buf bytes.Buffer _ = schematicHeroComponent(data).Render(ctx, &buf) return buf.String() }