From 3207394c380f7dbf4a3fb3af2459228fcc8b1b63 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Sat, 4 Jul 2026 15:26:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20convert=20to=20codeless=20.bnp=20?= =?UTF-8?q?=E2=80=94=20templates=20+=20manifest,=20Go/templ=20deleted=20(W?= =?UTF-8?q?O-WZ-021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- Makefile | 40 +- blocks/blocks.yaml | 54 ++ blocks/case_study_card.ninjatpl | 1 + .../case_study_card.schema.json | 0 blocks/cta_strip.ninjatpl | 1 + {schemas => blocks}/cta_strip.schema.json | 0 blocks/footer.ninjatpl | 1 + {schemas => blocks}/footer.schema.json | 0 blocks/hero_statement.ninjatpl | 1 + .../hero_statement.schema.json | 0 blocks/leadership_grid.ninjatpl | 1 + .../leadership_grid.schema.json | 0 blocks/logo_strip.ninjatpl | 1 + {schemas => blocks}/logo_strip.schema.json | 0 blocks/stat_pair.ninjatpl | 1 + {schemas => blocks}/stat_pair.schema.json | 0 blocks/testimonial_quote.ninjatpl | 1 + .../testimonial_quote.schema.json | 0 button_override.go | 31 - button_override.templ | 21 - button_override_templ.go | 107 ---- card_override.go | 22 - card_override.templ | 25 - card_override_templ.go | 122 ---- case_study_card.go | 57 -- case_study_card.templ | 35 -- case_study_card_templ.go | 165 ------ css_manifest.go | 53 -- cta_strip.go | 58 -- cta_strip.templ | 56 -- cta_strip_templ.go | 177 ------ email_wrapper.go | 21 - email_wrapper.templ | 117 ---- email_wrapper_templ.go | 228 -------- embed.go | 49 -- footer.go | 75 --- footer.templ | 60 -- footer_templ.go | 198 ------- go.mod | 20 - go.sum | 46 -- heading_override.go | 41 -- heading_override.templ | 57 -- heading_override_templ.go | 313 ----------- helpers.go | 82 --- hero_statement.go | 66 --- hero_statement.templ | 45 -- hero_statement_templ.go | 183 ------ leadership_grid.go | 60 -- leadership_grid.templ | 48 -- leadership_grid_templ.go | 207 ------- logo_strip.go | 55 -- logo_strip.templ | 44 -- logo_strip_templ.go | 203 ------- main.go | 17 - manifest.yaml | 85 +++ master_pages.json | 24 + plugin.mod | 5 +- register.go | 169 ------ registration.go | 34 -- stat_pair.go | 56 -- stat_pair.templ | 45 -- stat_pair_templ.go | 167 ------ template.templ | 274 --------- template_templ.go | 528 ------------------ .../corporate-modernist/article.ninjatpl | 20 + .../corporate-modernist/default.ninjatpl | 19 + .../corporate-modernist/full-width.ninjatpl | 15 + .../corporate-modernist/landing.ninjatpl | 17 + templates/email/corporate-modernist.ninjatpl | 62 ++ .../corporate-modernist/button.ninjatpl | 1 + .../corporate-modernist/card.ninjatpl | 1 + .../corporate-modernist/heading.ninjatpl | 1 + .../corporate-modernist/text.ninjatpl | 1 + testimonial_quote.go | 43 -- testimonial_quote.templ | 63 --- testimonial_quote_templ.go | 213 ------- text_override.go | 17 - text_override.templ | 8 - text_override_templ.go | 67 --- 79 files changed, 327 insertions(+), 4874 deletions(-) create mode 100644 blocks/blocks.yaml create mode 100644 blocks/case_study_card.ninjatpl rename {schemas => blocks}/case_study_card.schema.json (100%) create mode 100644 blocks/cta_strip.ninjatpl rename {schemas => blocks}/cta_strip.schema.json (100%) create mode 100644 blocks/footer.ninjatpl rename {schemas => blocks}/footer.schema.json (100%) create mode 100644 blocks/hero_statement.ninjatpl rename {schemas => blocks}/hero_statement.schema.json (100%) create mode 100644 blocks/leadership_grid.ninjatpl rename {schemas => blocks}/leadership_grid.schema.json (100%) create mode 100644 blocks/logo_strip.ninjatpl rename {schemas => blocks}/logo_strip.schema.json (100%) create mode 100644 blocks/stat_pair.ninjatpl rename {schemas => blocks}/stat_pair.schema.json (100%) create mode 100644 blocks/testimonial_quote.ninjatpl rename {schemas => blocks}/testimonial_quote.schema.json (100%) delete mode 100644 button_override.go delete mode 100644 button_override.templ delete mode 100644 button_override_templ.go delete mode 100644 card_override.go delete mode 100644 card_override.templ delete mode 100644 card_override_templ.go delete mode 100644 case_study_card.go delete mode 100644 case_study_card.templ delete mode 100644 case_study_card_templ.go delete mode 100644 css_manifest.go delete mode 100644 cta_strip.go delete mode 100644 cta_strip.templ delete mode 100644 cta_strip_templ.go delete mode 100644 email_wrapper.go delete mode 100644 email_wrapper.templ delete mode 100644 email_wrapper_templ.go delete mode 100644 embed.go delete mode 100644 footer.go delete mode 100644 footer.templ delete mode 100644 footer_templ.go delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 heading_override.go delete mode 100644 heading_override.templ delete mode 100644 heading_override_templ.go delete mode 100644 helpers.go delete mode 100644 hero_statement.go delete mode 100644 hero_statement.templ delete mode 100644 hero_statement_templ.go delete mode 100644 leadership_grid.go delete mode 100644 leadership_grid.templ delete mode 100644 leadership_grid_templ.go delete mode 100644 logo_strip.go delete mode 100644 logo_strip.templ delete mode 100644 logo_strip_templ.go delete mode 100644 main.go create mode 100644 manifest.yaml create mode 100644 master_pages.json delete mode 100644 register.go delete mode 100644 registration.go delete mode 100644 stat_pair.go delete mode 100644 stat_pair.templ delete mode 100644 stat_pair_templ.go delete mode 100644 template.templ delete mode 100644 template_templ.go create mode 100644 templates/corporate-modernist/article.ninjatpl create mode 100644 templates/corporate-modernist/default.ninjatpl create mode 100644 templates/corporate-modernist/full-width.ninjatpl create mode 100644 templates/corporate-modernist/landing.ninjatpl create mode 100644 templates/email/corporate-modernist.ninjatpl create mode 100644 templates/overrides/corporate-modernist/button.ninjatpl create mode 100644 templates/overrides/corporate-modernist/card.ninjatpl create mode 100644 templates/overrides/corporate-modernist/heading.ninjatpl create mode 100644 templates/overrides/corporate-modernist/text.ninjatpl delete mode 100644 testimonial_quote.go delete mode 100644 testimonial_quote.templ delete mode 100644 testimonial_quote_templ.go delete mode 100644 text_override.go delete mode 100644 text_override.templ delete mode 100644 text_override_templ.go diff --git a/Makefile b/Makefile index 24a0069..45c8ae7 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,27 @@ -# corporate-modernist — build & publish helpers (wasm .bnp workflow) +# corporate-modernist — build & publish helpers (CODELESS .bnp workflow, WO-WZ-021) # -# The theme compiles to a wasip1 reactor-mode wasm module packed into a .bnp -# artifact (`ninja plugin build`). The legacy .so path is retired (WO-WZ-015): -# the CMS is wasm-native and can no longer load .so plugins. Distribution is -# publish-to-registry -> InstallFromRegistry (hot-load, no restart). +# This theme is a CODELESS .bnp: pure declaration the host runs — blocks +# (blocks/blocks.yaml + .ninjatpl), page/system templates, template overrides, +# an email wrapper, master pages, presets, fonts and CSS in manifest.yaml. No +# Go, no templ, no plugin.wasm, no block/core dependency. `ninja plugin build` +# classifies the repo as codeless (no Go at the root) and packs the artifact +# with manifest.pb (codeless: true) and NO plugin.wasm. # # Usage: -# make build # compile wasm + pack corporate-modernist-.bnp -# make verify # validate the built .bnp (layout/abi/name/size) -# make archive-check # prove a clean `git archive HEAD` compiles to wasm +# make build # pack corporate-modernist-.bnp (codeless — no wasm) +# make verify # validate the built .bnp (loader-identical checks) +# make archive-check # prove a clean `git archive HEAD` still builds codeless # make publish # ninja plugin publish --bnp (to the active registry) -# make templ # regenerate templ Go files # make clean # remove build artefacts -.PHONY: build verify archive-check publish templ clean help +.PHONY: build verify archive-check publish clean help PLUGIN_NAME := corporate-modernist NINJA := ninja BNP := $(PLUGIN_NAME)-$(shell grep '^version' plugin.mod | sed 's/.*"\(.*\)"/\1/').bnp -# Compile to wasm and pack the .bnp (GOOS=wasip1 GOARCH=wasm, DESCRIBE probe, -# tar.zst of plugin.wasm + plugin.mod + manifest.pb + schemas/ + assets/). +# Pack the codeless .bnp (manifest.pb synthesized from plugin.mod + manifest.yaml +# + blocks/ + templates/; no wasm compile, no DESCRIBE probe). build: $(NINJA) plugin build --dir . @@ -28,12 +29,12 @@ build: verify: $(NINJA) plugin verify $(BNP) -# Prove a clean `git archive HEAD` (what publish ships) compiles to wasm. +# Prove a clean `git archive HEAD` (what publish ships) still packs codeless. archive-check: @T=$$(mktemp -d /tmp/archive-check-$(PLUGIN_NAME).XXXXXX) && \ trap 'rm -rf "$$T"' EXIT && \ git archive HEAD | tar -x -C "$$T" && \ - cd "$$T" && GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o "$$T/check.wasm" . && \ + cd "$$T" && $(NINJA) plugin build --dir . && \ echo "archive-check OK" # Publish the prebuilt .bnp to the active registry. @@ -41,19 +42,14 @@ archive-check: publish: build $(NINJA) plugin publish --bnp $(BNP) -# Regenerate templ Go files locally. -templ: - templ generate - # Remove build artefacts. clean: - rm -f $(PLUGIN_NAME)-*.bnp $(PLUGIN_NAME).so plugin.wasm + rm -f $(PLUGIN_NAME)-*.bnp plugin.wasm help: @echo "Targets:" - @echo " build Compile wasm + pack the .bnp" + @echo " build Pack the codeless .bnp (no wasm)" @echo " verify Validate the built .bnp (loader-identical checks)" - @echo " archive-check Prove a clean git archive HEAD compiles to wasm" + @echo " archive-check Prove a clean git archive HEAD packs codeless" @echo " publish Publish the .bnp to the active registry" - @echo " templ Regenerate templ Go files" @echo " clean Remove build artefacts" diff --git a/blocks/blocks.yaml b/blocks/blocks.yaml new file mode 100644 index 0000000..6c93b14 --- /dev/null +++ b/blocks/blocks.yaml @@ -0,0 +1,54 @@ +# Corporate Modernist theme block definitions (codeless .bnp, WO-WZ-021). +# Keys are fully qualified (corporate-modernist:) because the codeless loader +# registers definitions verbatim — there is no PluginBlockRegistry prefixing in the +# codeless path (unlike the wasm/templ path). The qualified keys match the hardcoded +# data-block attributes and the master_pages.json references. +blocks: + - key: corporate-modernist:hero_statement + title: Hero Statement + description: Restrained hero with eyebrow, headline, lede, and a single accent CTA. + category: layout + schema: hero_statement.schema.json + template: hero_statement.ninjatpl + - key: corporate-modernist:logo_strip + title: Client Logo Strip + description: Row of client logos, greyscale until hover. + category: content + schema: logo_strip.schema.json + template: logo_strip.ninjatpl + - key: corporate-modernist:testimonial_quote + title: Testimonial + description: Pull-quote testimonial with attribution, headshot, and company mark. + category: content + schema: testimonial_quote.schema.json + template: testimonial_quote.ninjatpl + - key: corporate-modernist:case_study_card + title: Case Study Card + description: Single case study card with a big tabular metric. + category: content + schema: case_study_card.schema.json + template: case_study_card.ninjatpl + - key: corporate-modernist:leadership_grid + title: Leadership Grid + description: Responsive 2/3/4-up grid of leadership profiles. + category: content + schema: leadership_grid.schema.json + template: leadership_grid.ninjatpl + - key: corporate-modernist:stat_pair + title: Stat Pair + description: Row of mono-numeral statistics separated by a hairline rule. + category: content + schema: stat_pair.schema.json + template: stat_pair.ninjatpl + - key: corporate-modernist:cta_strip + title: CTA Strip + description: Single-line accent strip with a headline and a primary call to action. + category: layout + schema: cta_strip.schema.json + template: cta_strip.ninjatpl + - key: corporate-modernist:footer + title: Footer + description: Multi-column footer with legal line; compact and full variants. + category: navigation + schema: footer.schema.json + template: footer.ninjatpl diff --git a/blocks/case_study_card.ninjatpl b/blocks/case_study_card.ninjatpl new file mode 100644 index 0000000..eb63ec2 --- /dev/null +++ b/blocks/case_study_card.ninjatpl @@ -0,0 +1 @@ + diff --git a/schemas/case_study_card.schema.json b/blocks/case_study_card.schema.json similarity index 100% rename from schemas/case_study_card.schema.json rename to blocks/case_study_card.schema.json diff --git a/blocks/cta_strip.ninjatpl b/blocks/cta_strip.ninjatpl new file mode 100644 index 0000000..26350f4 --- /dev/null +++ b/blocks/cta_strip.ninjatpl @@ -0,0 +1 @@ +
diff --git a/schemas/cta_strip.schema.json b/blocks/cta_strip.schema.json similarity index 100% rename from schemas/cta_strip.schema.json rename to blocks/cta_strip.schema.json diff --git a/blocks/footer.ninjatpl b/blocks/footer.ninjatpl new file mode 100644 index 0000000..44d0731 --- /dev/null +++ b/blocks/footer.ninjatpl @@ -0,0 +1 @@ + diff --git a/schemas/footer.schema.json b/blocks/footer.schema.json similarity index 100% rename from schemas/footer.schema.json rename to blocks/footer.schema.json diff --git a/blocks/hero_statement.ninjatpl b/blocks/hero_statement.ninjatpl new file mode 100644 index 0000000..71ad6dd --- /dev/null +++ b/blocks/hero_statement.ninjatpl @@ -0,0 +1 @@ +
{% if eyebrow %}
{{ eyebrow }}
{% endif %}{% if headline %}

{{ headline }}

{% endif %}{% if lede %}

{{ lede }}

{% endif %}{% if primaryCta.label or primaryCta.text or primaryCta.href or primaryCta.url or secondaryCta.label or secondaryCta.text or secondaryCta.href or secondaryCta.url %}
{% if primaryCta.label or primaryCta.text or primaryCta.href or primaryCta.url %}{{ primaryCta.label|default:primaryCta.text|default:"Get in touch" }}{% endif %}{% if secondaryCta.label or secondaryCta.text or secondaryCta.href or secondaryCta.url %}{{ secondaryCta.label|default:secondaryCta.text|default:"Learn more" }}{% endif %}
{% endif %}
diff --git a/schemas/hero_statement.schema.json b/blocks/hero_statement.schema.json similarity index 100% rename from schemas/hero_statement.schema.json rename to blocks/hero_statement.schema.json diff --git a/blocks/leadership_grid.ninjatpl b/blocks/leadership_grid.ninjatpl new file mode 100644 index 0000000..c4d6f4c --- /dev/null +++ b/blocks/leadership_grid.ninjatpl @@ -0,0 +1 @@ +
{% if title %}

{{ title }}

{% endif %}{% if members %}
{% for m in members %}{% if m.name %}
{% if m.photo %}{{ m.name|default:{% else %}{% endif %}
{{ m.name }}
{% if m.role %}
{{ m.role }}
{% endif %}{% if m.bio %}

{{ m.bio }}

{% endif %}{% if m.linkedin %}{% endif %}
{% endif %}{% endfor %}
{% else %}

No team members configured.

{% endif %}
diff --git a/schemas/leadership_grid.schema.json b/blocks/leadership_grid.schema.json similarity index 100% rename from schemas/leadership_grid.schema.json rename to blocks/leadership_grid.schema.json diff --git a/blocks/logo_strip.ninjatpl b/blocks/logo_strip.ninjatpl new file mode 100644 index 0000000..7207d11 --- /dev/null +++ b/blocks/logo_strip.ninjatpl @@ -0,0 +1 @@ +
{% if caption %}

{{ caption }}

{% endif %}{% if logos %}
{% for logo in logos %}{% if logo.src or logo.alt %}{% if logo.href %}{% else %}{% endif %}{% endif %}{% endfor %}
{% else %}

No client logos configured.

{% endif %}
diff --git a/schemas/logo_strip.schema.json b/blocks/logo_strip.schema.json similarity index 100% rename from schemas/logo_strip.schema.json rename to blocks/logo_strip.schema.json diff --git a/blocks/stat_pair.ninjatpl b/blocks/stat_pair.ninjatpl new file mode 100644 index 0000000..96bc3fe --- /dev/null +++ b/blocks/stat_pair.ninjatpl @@ -0,0 +1 @@ +
{% if title %}

{{ title }}

{% endif %}{% if stats %}
{% for s in stats %}{% if s.figure %}
{{ s.figure }}
{% if s.label %}
{{ s.label }}
{% endif %}{% if s.source %}
{{ s.source }}
{% endif %}
{% endif %}{% endfor %}
{% else %}

No statistics configured.

{% endif %}
diff --git a/schemas/stat_pair.schema.json b/blocks/stat_pair.schema.json similarity index 100% rename from schemas/stat_pair.schema.json rename to blocks/stat_pair.schema.json diff --git a/blocks/testimonial_quote.ninjatpl b/blocks/testimonial_quote.ninjatpl new file mode 100644 index 0000000..ac52b46 --- /dev/null +++ b/blocks/testimonial_quote.ninjatpl @@ -0,0 +1 @@ +
{% if quote %}
{{ quote }}
{% else %}
No testimonial provided.
{% endif %}
{% if headshot %}{{ name|default:{% else %}{% endif %}
{% if name %}
{{ name }}
{% endif %}{% if role or company %}
{% if role and company %}{{ role }}, {{ company }}{% elif role %}{{ role }}{% else %}{{ company }}{% endif %}
{% endif %}
{% if logo %}{% endif %}
diff --git a/schemas/testimonial_quote.schema.json b/blocks/testimonial_quote.schema.json similarity index 100% rename from schemas/testimonial_quote.schema.json rename to blocks/testimonial_quote.schema.json diff --git a/button_override.go b/button_override.go deleted file mode 100644 index 6cd406b..0000000 --- a/button_override.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// CorporateModernistButtonBlock renders the built-in `button` block with -// squared 4px corners, accent fill or 1px outline only — no shadow, no -// gradient. Content shape: {"label":"...", "href":"...", "variant":"primary|outline"}. -func CorporateModernistButtonBlock(ctx context.Context, content map[string]any) string { - label := getString(content, "label") - if label == "" { - label = getString(content, "text") - } - href := getString(content, "href") - if href == "" { - href = getString(content, "url") - } - if href == "" { - href = "#" - } - variant := getString(content, "variant") - if variant == "" { - variant = "primary" - } - - var buf bytes.Buffer - _ = buttonOverrideComponent(label, href, variant).Render(ctx, &buf) - return buf.String() -} diff --git a/button_override.templ b/button_override.templ deleted file mode 100644 index bcc4b8e..0000000 --- a/button_override.templ +++ /dev/null @@ -1,21 +0,0 @@ -package main - -// buttonOverrideComponent renders a Corporate Modernist styled button. -templ buttonOverrideComponent(label, href, variant string) { - if variant == "outline" || variant == "secondary" { - - { buttonOverrideLabel(label) } - - } else { - - { buttonOverrideLabel(label) } - - } -} - -func buttonOverrideLabel(label string) string { - if label != "" { - return label - } - return "Learn more" -} diff --git a/button_override_templ.go b/button_override_templ.go deleted file mode 100644 index 6ce611e..0000000 --- a/button_override_templ.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// buttonOverrideComponent renders a Corporate Modernist styled button. -func buttonOverrideComponent(label, href, variant string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if variant == "outline" || variant == "secondary" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(buttonOverrideLabel(label)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `button_override.templ`, Line: 7, Col: 31} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(buttonOverrideLabel(label)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `button_override.templ`, Line: 11, Col: 31} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -func buttonOverrideLabel(label string) string { - if label != "" { - return label - } - return "Learn more" -} - -var _ = templruntime.GeneratedTemplate diff --git a/card_override.go b/card_override.go deleted file mode 100644 index 5676950..0000000 --- a/card_override.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// CorporateModernistCardBlock renders the built-in `card` block with a flat -// surface, hairline border, no elevation, and an optional accent top rule. -// Content shape: {"title":"...","body":"...","accent": true|false}. -func CorporateModernistCardBlock(ctx context.Context, content map[string]any) string { - title := getString(content, "title") - body := getString(content, "body") - if body == "" { - body = getString(content, "text") - } - accent := getBool(content, "accent", false) - - var buf bytes.Buffer - _ = cardOverrideComponent(title, body, accent).Render(ctx, &buf) - return buf.String() -} diff --git a/card_override.templ b/card_override.templ deleted file mode 100644 index f2bcd5c..0000000 --- a/card_override.templ +++ /dev/null @@ -1,25 +0,0 @@ -package main - -// cardOverrideComponent renders a flat hairline-bordered card. -templ cardOverrideComponent(title, body string, accent bool) { - if accent { -
- @cardOverrideInner(title, body) -
- } else { -
- @cardOverrideInner(title, body) -
- } -} - -templ cardOverrideInner(title, body string) { - if title != "" { -
{ title }
- } - if body != "" { -
- @templ.Raw(body) -
- } -} diff --git a/card_override_templ.go b/card_override_templ.go deleted file mode 100644 index 38ea3a9..0000000 --- a/card_override_templ.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// cardOverrideComponent renders a flat hairline-bordered card. -func cardOverrideComponent(title, body string, accent bool) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if accent { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = cardOverrideInner(title, body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = cardOverrideInner(title, body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -func cardOverrideInner(title, body string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `card_override.templ`, Line: 18, Col: 102} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if body != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(body).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/case_study_card.go b/case_study_card.go deleted file mode 100644 index e4f56d2..0000000 --- a/case_study_card.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// CaseStudyCardMeta is the block metadata for corporate-modernist:case_study_card. -var CaseStudyCardMeta = blocks.BlockMeta{ - Key: "case_study_card", - Title: "Case Study Card", - Description: "Single case study card with a big tabular metric.", - Source: "corporate-modernist", - Category: blocks.CategoryContent, -} - -// CaseStudyCardData carries the parsed content for the case_study_card block. -type CaseStudyCardData struct { - Client string - Metric string - Label string - Summary string - HrefLabel string - Href string - HasLink bool -} - -// CaseStudyCardBlock renders the case_study_card block. -func CaseStudyCardBlock(ctx context.Context, content map[string]any) string { - link := getNested(content, "href") - hrefLabel := "" - href := "" - hasLink := false - if link != nil { - hrefLabel = linkLabel(link, "") - href = linkHref(link) - if hrefLabel != "" || href != "#" { - hasLink = true - } - } - - data := CaseStudyCardData{ - Client: getString(content, "client"), - Metric: getString(content, "metric"), - Label: getString(content, "label"), - Summary: getString(content, "summary"), - HrefLabel: hrefLabel, - Href: href, - HasLink: hasLink, - } - - var buf bytes.Buffer - _ = caseStudyCardComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/case_study_card.templ b/case_study_card.templ deleted file mode 100644 index bd3063b..0000000 --- a/case_study_card.templ +++ /dev/null @@ -1,35 +0,0 @@ -package main - -// caseStudyCardComponent renders the corporate-modernist:case_study_card block. -templ caseStudyCardComponent(data CaseStudyCardData) { -
- if data.Client != "" { -
{ data.Client }
- } - if data.Metric != "" { -
{ data.Metric }
- } else { -
- } - if data.Label != "" { -
{ data.Label }
- } - if data.Summary != "" { -

{ data.Summary }

- } - if data.HasLink { - - } -
-} - -func caseStudyCardLinkLabel(data CaseStudyCardData) string { - if data.HrefLabel != "" { - return data.HrefLabel - } - return "Read case study" -} diff --git a/case_study_card_templ.go b/case_study_card_templ.go deleted file mode 100644 index c5f7fc0..0000000 --- a/case_study_card_templ.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// caseStudyCardComponent renders the corporate-modernist:case_study_card block. -func caseStudyCardComponent(data CaseStudyCardData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Client != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Client) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `case_study_card.templ`, Line: 7, Col: 74} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Metric != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Metric) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `case_study_card.templ`, Line: 10, Col: 51} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Label != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.Label) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `case_study_card.templ`, Line: 15, Col: 70} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Summary != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.Summary) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `case_study_card.templ`, Line: 18, Col: 67} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.HasLink { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func caseStudyCardLinkLabel(data CaseStudyCardData) string { - if data.HrefLabel != "" { - return data.HrefLabel - } - return "Read case study" -} - -var _ = templruntime.GeneratedTemplate diff --git a/css_manifest.go b/css_manifest.go deleted file mode 100644 index 252e282..0000000 --- a/css_manifest.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -// corporateModernistUtilityCSS is appended to the host Tailwind input.css so the -// theme's .cm-* utility classes resolve in the production CSS bundle. The same -// rules also live in assets/style.css so the standalone stylesheet served at -// /templates/corporate-modernist/style.css is self-contained for fallback usage. -// -// Per FONTS.md: no @font-face declarations here. Font faces are emitted by the -// CMS from fonts.json — currently [], so the theme relies on the -// --font-heading / --font-body / --font-mono CSS variables with fallback stacks. -const corporateModernistUtilityCSS = ` -/* Corporate Modernist — appended utility CSS. */ -.cm-content-well { width: 100%; max-width: 1280px; margin-left: auto; margin-right: auto; padding-left: 1.5rem; padding-right: 1.5rem; box-sizing: border-box; } -.cm-swiss-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 1.5rem; row-gap: 1.5rem; } -.cm-hairline { border-color: hsl(var(--border)); border-width: 1px; border-style: solid; } -.cm-hairline-top { border-top: 1px solid hsl(var(--border)); } -.cm-hairline-bottom { border-bottom: 1px solid hsl(var(--border)); } -.numeric-tabular { font-variant-numeric: tabular-nums; } -.cm-display { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 600; letter-spacing: -0.02em; } -.cm-body { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; font-variant-numeric: tabular-nums; } -.cm-mono { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; } -.cm-accent-rule { border-top: 2px solid hsl(var(--accent)); } -.cm-btn-primary { display: inline-block; padding: 0.625rem 1.25rem; background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); border: 1px solid hsl(var(--accent)); border-radius: 4px; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 500; text-decoration: none; line-height: 1.4; box-shadow: none; background-image: none; transition: background-color 150ms ease; } -.cm-btn-primary:hover { background-color: hsl(var(--accent) / 0.9); } -.cm-btn-primary:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; } -.cm-btn-outline { display: inline-block; padding: 0.625rem 1.25rem; background-color: transparent; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); border-radius: 4px; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 500; text-decoration: none; line-height: 1.4; box-shadow: none; background-image: none; transition: border-color 150ms ease; } -.cm-btn-outline:hover { border-color: hsl(var(--foreground)); } -.cm-btn-outline:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; } -.cm-card { background-color: hsl(var(--card)); color: hsl(var(--card-foreground)); border: 1px solid hsl(var(--border)); border-radius: 4px; padding: 1.5rem; box-shadow: none; } -.cm-card.cm-card-accent { border-top: 2px solid hsl(var(--accent)); } -.cm-heading { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 600; letter-spacing: -0.02em; color: hsl(var(--foreground)); margin: 0; } -.cm-heading-h2-accent { border-bottom: 2px solid hsl(var(--accent)); padding-bottom: 0.25rem; display: inline-block; } -.cm-text { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; color: hsl(var(--foreground)); font-variant-numeric: tabular-nums; hanging-punctuation: first last; } -.cm-logo { filter: grayscale(1); opacity: 0.7; transition: filter 200ms ease, opacity 200ms ease; } -.cm-logo:hover { filter: grayscale(0); opacity: 1; } -.cm-pull-quote { border-top: 2px solid hsl(var(--accent)); padding-top: 1.25rem; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-size: 1.5rem; line-height: 1.4; font-weight: 500; color: hsl(var(--foreground)); } -.cm-metric { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-size: 3rem; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; color: hsl(var(--accent)); } -.cm-stat-figure { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-size: 2.5rem; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; color: hsl(var(--foreground)); } -.cm-stat-label { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 0.875rem; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem; } -.cm-eyebrow { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-size: 0.875rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: hsl(var(--accent)); margin-bottom: 1rem; } -.cm-cta-strip-accent { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); } -.cm-cta-strip-accent .cm-btn-primary { background-color: hsl(var(--accent-foreground)); color: hsl(var(--accent)); border-color: hsl(var(--accent-foreground)); } -.cm-cta-strip-quiet { background-color: hsl(var(--muted)); color: hsl(var(--foreground)); } -.cm-footer { background-color: hsl(var(--background)); color: hsl(var(--foreground)); border-top: 1px solid hsl(var(--border)); padding: 3rem 0; } -.cm-footer-legal { color: hsl(var(--muted-foreground)); font-size: 0.875rem; border-top: 1px solid hsl(var(--border)); padding-top: 1.5rem; margin-top: 2rem; } -.cm-leadership-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1.5rem; } -@media (min-width: 640px) { .cm-leadership-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } } -@media (min-width: 1024px) { .cm-leadership-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } } -@media (min-width: 1280px) { .cm-leadership-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } } -.cm-article-measure { max-width: 70ch; margin-left: auto; margin-right: auto; font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; color: hsl(var(--foreground)); } -.cm-section { padding-top: 4rem; padding-bottom: 4rem; } -.cm-img-empty { display: block; width: 100%; aspect-ratio: 4 / 3; background-color: hsl(var(--muted)); border: 1px solid hsl(var(--border)); } -` diff --git a/cta_strip.go b/cta_strip.go deleted file mode 100644 index c78aca8..0000000 --- a/cta_strip.go +++ /dev/null @@ -1,58 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// CTAStripMeta is the block metadata for corporate-modernist:cta_strip. -var CTAStripMeta = blocks.BlockMeta{ - Key: "cta_strip", - Title: "CTA Strip", - Description: "Single-line accent strip with a headline and a primary call to action.", - Source: "corporate-modernist", - Category: blocks.CategoryLayout, -} - -// CTAStripData carries the parsed content for the cta_strip block. -type CTAStripData struct { - Headline string - CTALabel string - CTAHref string - HasCTA bool - Variant string -} - -// CTAStripBlock renders the cta_strip block. -func CTAStripBlock(ctx context.Context, content map[string]any) string { - primary := getNested(content, "primaryCta") - ctaLabel := "" - ctaHref := "" - hasCTA := false - if primary != nil { - ctaLabel = linkLabel(primary, "") - ctaHref = linkHref(primary) - if ctaLabel != "" || ctaHref != "#" { - hasCTA = true - } - } - - variant := getString(content, "variant") - if variant == "" { - variant = "book-call" - } - - data := CTAStripData{ - Headline: getString(content, "headline"), - CTALabel: ctaLabel, - CTAHref: ctaHref, - HasCTA: hasCTA, - Variant: variant, - } - - var buf bytes.Buffer - _ = ctaStripComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/cta_strip.templ b/cta_strip.templ deleted file mode 100644 index f443abc..0000000 --- a/cta_strip.templ +++ /dev/null @@ -1,56 +0,0 @@ -package main - -// ctaStripComponent renders the corporate-modernist:cta_strip block. -templ ctaStripComponent(data CTAStripData) { -
-
-
- if data.Headline != "" { -

{ data.Headline }

- } else { -

Ready when you are.

- } - if data.HasCTA { - - { ctaStripLabel(data) } - - } else { - - { ctaStripDefaultLabel(data.Variant) } - - } -
-
-
-} - -func ctaStripVariantClass(variant string) string { - switch variant { - case "quiet": - return "cm-cta-strip-quiet" - default: - return "cm-cta-strip-accent" - } -} - -func ctaStripLabel(data CTAStripData) string { - if data.CTALabel != "" { - return data.CTALabel - } - return ctaStripDefaultLabel(data.Variant) -} - -func ctaStripDefaultLabel(variant string) string { - switch variant { - case "download": - return "Download report" - case "quiet": - return "Learn more" - default: - return "Book a call" - } -} diff --git a/cta_strip_templ.go b/cta_strip_templ.go deleted file mode 100644 index 059a1de..0000000 --- a/cta_strip_templ.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// ctaStripComponent renders the corporate-modernist:cta_strip block. -func ctaStripComponent(data CTAStripData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - var templ_7745c5c3_Var2 = []any{"cm-section", ctaStripVariantClass(data.Variant)} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Headline != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.Headline) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cta_strip.templ`, Line: 13, Col: 100} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

Ready when you are.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.HasCTA { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(ctaStripLabel(data)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cta_strip.templ`, Line: 19, Col: 27} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(ctaStripDefaultLabel(data.Variant)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cta_strip.templ`, Line: 23, Col: 42} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func ctaStripVariantClass(variant string) string { - switch variant { - case "quiet": - return "cm-cta-strip-quiet" - default: - return "cm-cta-strip-accent" - } -} - -func ctaStripLabel(data CTAStripData) string { - if data.CTALabel != "" { - return data.CTALabel - } - return ctaStripDefaultLabel(data.Variant) -} - -func ctaStripDefaultLabel(variant string) string { - switch variant { - case "download": - return "Download report" - case "quiet": - return "Learn more" - default: - return "Book a call" - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/email_wrapper.go b/email_wrapper.go deleted file mode 100644 index 55f4d4e..0000000 --- a/email_wrapper.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/templates" -) - -// CorporateModernistEmailWrapper wraps body content in a 600px-wide -// Corporate Modernist email. Tokens are locked to the navy-classic light -// preset regardless of the active site preset, in line with §10 of the -// spec, to maximise email-client compatibility. -// -// Colours are expressed via hsl() with the navy-classic HSL triples; no -// hex literals appear in the source. -func CorporateModernistEmailWrapper(body string, emailCtx templates.EmailContext) string { - var buf bytes.Buffer - _ = emailWrapperComponent(emailCtx, body).Render(context.Background(), &buf) - return buf.String() -} diff --git a/email_wrapper.templ b/email_wrapper.templ deleted file mode 100644 index e0fd515..0000000 --- a/email_wrapper.templ +++ /dev/null @@ -1,117 +0,0 @@ -package main - -import "git.dev.alexdunmow.com/block/core/templates" - -// emailWrapperComponent renders the Corporate Modernist email wrapper. -// -// The wrapper is locked to the navy-classic light preset regardless of the -// active site preset (per spec §10) for email-client compatibility. CSS -// custom properties are declared in ; every inline `style="…"` -// references them via var(--cm-email-*) with the navy-classic HSL triple -// as the fallback, so: -// - email clients that strip - - - if emailCtx.PreviewText != "" { -
- { emailCtx.PreviewText } -
- } - - - - -
- - - - - - - - - - - - - - - - - -
- - -} diff --git a/email_wrapper_templ.go b/email_wrapper_templ.go deleted file mode 100644 index 1d51fee..0000000 --- a/email_wrapper_templ.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "git.dev.alexdunmow.com/block/core/templates" - -// emailWrapperComponent renders the Corporate Modernist email wrapper. -// -// The wrapper is locked to the navy-classic light preset regardless of the -// active site preset (per spec §10) for email-client compatibility. CSS -// custom properties are declared in ; every inline `style="…"` -// references them via var(--cm-email-*) with the navy-classic HSL triple -// as the fallback, so: -// - email clients that strip ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if emailCtx.PreviewText != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(emailCtx.PreviewText) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `email_wrapper.templ`, Line: 48, Col: 27} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/embed.go b/embed.go deleted file mode 100644 index 70bc542..0000000 --- a/embed.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "embed" - "io/fs" - "net/http" -) - -//go:embed assets/* -var assetsFS embed.FS - -//go:embed schemas/* -var schemasFS embed.FS - -//go:embed presets.json -var presetsData []byte - -//go:embed fonts.json -var fontsData []byte - -//go:embed plugin.mod -var pluginModBytes []byte - -// Assets returns the embedded assets filesystem rooted at assets/. -func Assets() fs.FS { - sub, _ := fs.Sub(assetsFS, "assets") - return sub -} - -// Schemas returns the embedded schemas filesystem rooted at schemas/. -func Schemas() fs.FS { - sub, _ := fs.Sub(schemasFS, "schemas") - return sub -} - -// AssetsHandler returns an http.Handler that serves the embedded assets. -func AssetsHandler() http.Handler { - return http.FileServer(http.FS(Assets())) -} - -// ThemePresets returns the embedded theme presets JSON. -func ThemePresets() []byte { - return presetsData -} - -// BundledFonts returns the embedded fonts manifest JSON. -func BundledFonts() []byte { - return fontsData -} diff --git a/footer.go b/footer.go deleted file mode 100644 index 63adf01..0000000 --- a/footer.go +++ /dev/null @@ -1,75 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// FooterMeta is the block metadata for corporate-modernist:footer. -var FooterMeta = blocks.BlockMeta{ - Key: "footer", - Title: "Footer", - Description: "Multi-column footer with legal line; compact and full variants.", - Source: "corporate-modernist", - Category: blocks.CategoryNavigation, -} - -// FooterLink represents a single link in a footer column. -type FooterLink struct { - Label string - Href string -} - -// FooterColumn is a single labelled column of footer links. -type FooterColumn struct { - Title string - Links []FooterLink -} - -// FooterData carries the parsed content for the footer block. -type FooterData struct { - Columns []FooterColumn - LegalLine string - ShowLegal bool - Variant string -} - -// FooterBlock renders the footer block. -func FooterBlock(ctx context.Context, content map[string]any) string { - rawColumns := getSlice(content, "columns") - columns := make([]FooterColumn, 0, len(rawColumns)) - for _, c := range rawColumns { - rawLinks := getSlice(c, "links") - links := make([]FooterLink, 0, len(rawLinks)) - for _, l := range rawLinks { - label := linkLabel(l, "") - href := linkHref(l) - if label == "" && href == "#" { - continue - } - links = append(links, FooterLink{Label: label, Href: href}) - } - columns = append(columns, FooterColumn{ - Title: getString(c, "title"), - Links: links, - }) - } - - variant := getString(content, "variant") - if variant == "" { - variant = "compact" - } - - data := FooterData{ - Columns: columns, - LegalLine: getString(content, "legalLine"), - ShowLegal: getBool(content, "showLegal", true), - Variant: variant, - } - - var buf bytes.Buffer - _ = footerComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/footer.templ b/footer.templ deleted file mode 100644 index 1161f47..0000000 --- a/footer.templ +++ /dev/null @@ -1,60 +0,0 @@ -package main - -// footerComponent renders the corporate-modernist:footer block. -templ footerComponent(data FooterData) { - -} - -func footerLinkLabel(l FooterLink) string { - if l.Label != "" { - return l.Label - } - return l.Href -} - -func footerColumnSpan(count int) string { - switch { - case count >= 4: - return "grid-column: span 3 / span 3;" - case count == 3: - return "grid-column: span 4 / span 4;" - case count == 2: - return "grid-column: span 6 / span 6;" - default: - return "grid-column: span 12 / span 12;" - } -} diff --git a/footer_templ.go b/footer_templ.go deleted file mode 100644 index 54144a1..0000000 --- a/footer_templ.go +++ /dev/null @@ -1,198 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// footerComponent renders the corporate-modernist:footer block. -func footerComponent(data FooterData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Variant == "full" && len(data.Columns) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, col := range data.Columns { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if col.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(col.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `footer.templ`, Line: 12, Col: 164} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(col.Links) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.ShowLegal { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func footerLinkLabel(l FooterLink) string { - if l.Label != "" { - return l.Label - } - return l.Href -} - -func footerColumnSpan(count int) string { - switch { - case count >= 4: - return "grid-column: span 3 / span 3;" - case count == 3: - return "grid-column: span 4 / span 4;" - case count == 2: - return "grid-column: span 6 / span 6;" - default: - return "grid-column: span 12 / span 12;" - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/go.mod b/go.mod deleted file mode 100644 index f84672f..0000000 --- a/go.mod +++ /dev/null @@ -1,20 +0,0 @@ -module git.dev.alexdunmow.com/block/themes/corporate-modernist - -go 1.26.4 - -require ( - git.dev.alexdunmow.com/block/core v0.15.2 - github.com/a-h/templ v0.3.1020 -) - -require ( - connectrpc.com/connect v1.20.0 // indirect - github.com/BurntSushi/toml v1.6.0 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - github.com/jackc/pgx/v5 v5.9.2 // indirect - golang.org/x/mod v0.34.0 // indirect - golang.org/x/text v0.36.0 // indirect - google.golang.org/protobuf v1.36.11 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index ebd3d11..0000000 --- a/go.sum +++ /dev/null @@ -1,46 +0,0 @@ -connectrpc.com/connect v1.20.0 h1:6TNDAB+WeNd2uolWNlYczB5E0KNNaVMNUEx8JEUsPmQ= -connectrpc.com/connect v1.20.0/go.mod h1:A2ygJrukXwWy32vkCAAHNVguZrqZ+jeZ9rGRnGR4dN4= -git.dev.alexdunmow.com/block/core v0.15.2 h1:qTjJxa1pClxwehkdTxXiJDpHQLr5DoXBUCa40QRO0L8= -git.dev.alexdunmow.com/block/core v0.15.2/go.mod h1:A+mgA9oeWoPhXruv4Mjpywwl2A9B5I3cKzlJjalBdlE= -github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= -github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/a-h/templ v0.3.1020 h1:ypAT/L5ySWEnZ6Zft/5yfoWXYYkhFNvEFOeeqecg4tw= -github.com/a-h/templ v0.3.1020/go.mod h1:A2DlK61v+K+NRoGnhmYbNYVmtYHcFO5/AisMvBdDxTM= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= -github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= -github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= -github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= -github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/tetratelabs/wazero v1.12.0 h1:DuWcpNu/FzgEXgGBDp8J1Spc+CWOvvtvVyjKlaZopYU= -github.com/tetratelabs/wazero v1.12.0/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0= -golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= -golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= -golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/heading_override.go b/heading_override.go deleted file mode 100644 index e8d704a..0000000 --- a/heading_override.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "bytes" - "context" - "strconv" -) - -// CorporateModernistHeadingBlock renders the built-in `heading` block with -// the Corporate Modernist treatment: tighter tracking, weights restricted to -// 500/600, accent underline on H2. -func CorporateModernistHeadingBlock(ctx context.Context, content map[string]any) string { - text := getString(content, "text") - textClass := getString(content, "textClass") - level := parseHeadingLevel(content) - - var buf bytes.Buffer - _ = headingOverrideComponent(level, text, textClass).Render(ctx, &buf) - return buf.String() -} - -// parseHeadingLevel pulls a level (1-6) from the block content map. -func parseHeadingLevel(content map[string]any) int { - if level, ok := content["level"].(float64); ok { - l := int(level) - if l >= 1 && l <= 6 { - return l - } - } - if level, ok := content["level"].(int); ok { - if level >= 1 && level <= 6 { - return level - } - } - if level, ok := content["level"].(string); ok { - if l, err := strconv.Atoi(level); err == nil && l >= 1 && l <= 6 { - return l - } - } - return 2 -} diff --git a/heading_override.templ b/heading_override.templ deleted file mode 100644 index 8285c2e..0000000 --- a/heading_override.templ +++ /dev/null @@ -1,57 +0,0 @@ -package main - -// headingOverrideComponent renders the Corporate Modernist heading override. -// All levels share the .cm-heading base; H2 picks up the accent underline. -templ headingOverrideComponent(level int, text, textClass string) { - switch level { - case 1: -

- { text } -

- case 2: -

- { text } -

- case 3: -

- { text } -

- case 4: -

- { text } -

- case 5: -
- { text } -
- case 6: -
- { text } -
- default: -

- { text } -

- } -} - -// headingOverrideSizeClass keeps the Tailwind-style size hooks predictable for -// downstream tooling without baking sizes into hardcoded classes. -func headingOverrideSizeClass(level int) string { - switch level { - case 1: - return "cm-heading-h1" - case 2: - return "cm-heading-h2" - case 3: - return "cm-heading-h3" - case 4: - return "cm-heading-h4" - case 5: - return "cm-heading-h5" - case 6: - return "cm-heading-h6" - default: - return "cm-heading-h2" - } -} diff --git a/heading_override_templ.go b/heading_override_templ.go deleted file mode 100644 index a3e4ac3..0000000 --- a/heading_override_templ.go +++ /dev/null @@ -1,313 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// headingOverrideComponent renders the Corporate Modernist heading override. -// All levels share the .cm-heading base; H2 picks up the accent underline. -func headingOverrideComponent(level int, text, textClass string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - switch level { - case 1: - var templ_7745c5c3_Var2 = []any{"cm-heading", headingOverrideSizeClass(1), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 9, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 2: - var templ_7745c5c3_Var5 = []any{"cm-heading", headingOverrideSizeClass(2), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 13, Col: 45} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 3: - var templ_7745c5c3_Var8 = []any{"cm-heading", headingOverrideSizeClass(3), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var8...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var10 string - templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 17, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 4: - var templ_7745c5c3_Var11 = []any{"cm-heading", headingOverrideSizeClass(4), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var11...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 21, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 5: - var templ_7745c5c3_Var14 = []any{"cm-heading", headingOverrideSizeClass(5), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var14...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var16 string - templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 25, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - case 6: - var templ_7745c5c3_Var17 = []any{"cm-heading", headingOverrideSizeClass(6), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var17...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var19 string - templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 29, Col: 10} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - default: - var templ_7745c5c3_Var20 = []any{"cm-heading", headingOverrideSizeClass(2), textClass} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var20...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(text) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `heading_override.templ`, Line: 33, Col: 45} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -// headingOverrideSizeClass keeps the Tailwind-style size hooks predictable for -// downstream tooling without baking sizes into hardcoded classes. -func headingOverrideSizeClass(level int) string { - switch level { - case 1: - return "cm-heading-h1" - case 2: - return "cm-heading-h2" - case 3: - return "cm-heading-h3" - case 4: - return "cm-heading-h4" - case 5: - return "cm-heading-h5" - case 6: - return "cm-heading-h6" - default: - return "cm-heading-h2" - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/helpers.go b/helpers.go deleted file mode 100644 index 0f55f88..0000000 --- a/helpers.go +++ /dev/null @@ -1,82 +0,0 @@ -package main - -import "strconv" - -// getString extracts a string value from content map. -func getString(content map[string]any, key string) string { - if content == nil { - return "" - } - if v, ok := content[key].(string); ok { - return v - } - return "" -} - -// getBool extracts a bool value from content map (handles JSON unmarshalling forms). -func getBool(content map[string]any, key string, defaultVal bool) bool { - if content == nil { - return defaultVal - } - if v, ok := content[key].(bool); ok { - return v - } - if v, ok := content[key].(string); ok { - if b, err := strconv.ParseBool(v); err == nil { - return b - } - } - return defaultVal -} - -// getSlice extracts a slice of maps from content. -func getSlice(content map[string]any, key string) []map[string]any { - if content == nil { - return nil - } - if v, ok := content[key].([]any); ok { - result := make([]map[string]any, 0, len(v)) - for _, item := range v { - if m, ok := item.(map[string]any); ok { - result = append(result, m) - } - } - return result - } - return nil -} - -// getNested extracts a nested map from content for sub-object fields (e.g. CTA link). -func getNested(content map[string]any, key string) map[string]any { - if content == nil { - return nil - } - if v, ok := content[key].(map[string]any); ok { - return v - } - return nil -} - -// linkHref returns the href value from a link object (label/href shape), -// defaulting to "#" when missing so anchors stay valid. -func linkHref(link map[string]any) string { - if href := getString(link, "href"); href != "" { - return href - } - if url := getString(link, "url"); url != "" { - return url - } - return "#" -} - -// linkLabel returns the visible label for a link object. -func linkLabel(link map[string]any, fallback string) string { - if label := getString(link, "label"); label != "" { - return label - } - if text := getString(link, "text"); text != "" { - return text - } - return fallback -} - diff --git a/hero_statement.go b/hero_statement.go deleted file mode 100644 index 5cb842c..0000000 --- a/hero_statement.go +++ /dev/null @@ -1,66 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// HeroStatementMeta is the block metadata for corporate-modernist:hero_statement. -var HeroStatementMeta = blocks.BlockMeta{ - Key: "hero_statement", - Title: "Hero Statement", - Description: "Restrained hero with eyebrow, headline, lede, and a single accent CTA.", - Source: "corporate-modernist", - Category: blocks.CategoryLayout, -} - -// HeroStatementCTA captures a single label/href pair for hero CTAs. -type HeroStatementCTA struct { - Label string - Href string -} - -// HeroStatementData carries the parsed content for the hero_statement block. -type HeroStatementData struct { - Eyebrow string - Headline string - Lede string - PrimaryCTA HeroStatementCTA - HasPrimary bool - SecondaryCTA HeroStatementCTA - HasSecondary bool -} - -// HeroStatementBlock renders the hero_statement block. -func HeroStatementBlock(ctx context.Context, content map[string]any) string { - primary := getNested(content, "primaryCta") - secondary := getNested(content, "secondaryCta") - - data := HeroStatementData{ - Eyebrow: getString(content, "eyebrow"), - Headline: getString(content, "headline"), - Lede: getString(content, "lede"), - } - if primary != nil { - label := linkLabel(primary, "") - href := linkHref(primary) - if label != "" || href != "#" { - data.PrimaryCTA = HeroStatementCTA{Label: label, Href: href} - data.HasPrimary = true - } - } - if secondary != nil { - label := linkLabel(secondary, "") - href := linkHref(secondary) - if label != "" || href != "#" { - data.SecondaryCTA = HeroStatementCTA{Label: label, Href: href} - data.HasSecondary = true - } - } - - var buf bytes.Buffer - _ = heroStatementComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/hero_statement.templ b/hero_statement.templ deleted file mode 100644 index 08cbe39..0000000 --- a/hero_statement.templ +++ /dev/null @@ -1,45 +0,0 @@ -package main - -// heroStatementComponent renders the corporate-modernist:hero_statement block. -templ heroStatementComponent(data HeroStatementData) { -
-
-
-
- if data.Eyebrow != "" { -
{ data.Eyebrow }
- } - if data.Headline != "" { -

- { data.Headline } -

- } - if data.Lede != "" { -

{ data.Lede }

- } - if data.HasPrimary || data.HasSecondary { - - } -
-
-
-
-} - -func heroStatementLabel(label, fallback string) string { - if label != "" { - return label - } - return fallback -} diff --git a/hero_statement_templ.go b/hero_statement_templ.go deleted file mode 100644 index 505306f..0000000 --- a/hero_statement_templ.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// heroStatementComponent renders the corporate-modernist:hero_statement block. -func heroStatementComponent(data HeroStatementData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Eyebrow != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Eyebrow) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `hero_statement.templ`, Line: 10, Col: 44} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Headline != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Headline) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `hero_statement.templ`, Line: 14, Col: 22} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Lede != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.Lede) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `hero_statement.templ`, Line: 18, Col: 81} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.HasPrimary || data.HasSecondary { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.HasPrimary { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(heroStatementLabel(data.PrimaryCTA.Label, "Get in touch")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `hero_statement.templ`, Line: 24, Col: 68} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.HasSecondary { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(heroStatementLabel(data.SecondaryCTA.Label, "Learn more")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `hero_statement.templ`, Line: 29, Col: 68} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func heroStatementLabel(label, fallback string) string { - if label != "" { - return label - } - return fallback -} - -var _ = templruntime.GeneratedTemplate diff --git a/leadership_grid.go b/leadership_grid.go deleted file mode 100644 index 7b70386..0000000 --- a/leadership_grid.go +++ /dev/null @@ -1,60 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// LeadershipGridMeta is the block metadata for corporate-modernist:leadership_grid. -var LeadershipGridMeta = blocks.BlockMeta{ - Key: "leadership_grid", - Title: "Leadership Grid", - Description: "Responsive 2/3/4-up grid of leadership profiles.", - Source: "corporate-modernist", - Category: blocks.CategoryContent, -} - -// LeadershipGridMember represents one leader entry. -type LeadershipGridMember struct { - Name string - Role string - Bio string - Photo string - LinkedIn string -} - -// LeadershipGridData carries the parsed content for the leadership_grid block. -type LeadershipGridData struct { - Title string - Members []LeadershipGridMember -} - -// LeadershipGridBlock renders the leadership_grid block. -func LeadershipGridBlock(ctx context.Context, content map[string]any) string { - rawMembers := getSlice(content, "members") - members := make([]LeadershipGridMember, 0, len(rawMembers)) - for _, m := range rawMembers { - name := getString(m, "name") - if name == "" { - continue - } - members = append(members, LeadershipGridMember{ - Name: name, - Role: getString(m, "role"), - Bio: getString(m, "bio"), - Photo: getString(m, "photo"), - LinkedIn: getString(m, "linkedin"), - }) - } - - data := LeadershipGridData{ - Title: getString(content, "title"), - Members: members, - } - - var buf bytes.Buffer - _ = leadershipGridComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/leadership_grid.templ b/leadership_grid.templ deleted file mode 100644 index 269a39b..0000000 --- a/leadership_grid.templ +++ /dev/null @@ -1,48 +0,0 @@ -package main - -// leadershipGridComponent renders the corporate-modernist:leadership_grid block. -templ leadershipGridComponent(data LeadershipGridData) { -
-
- if data.Title != "" { -

- { data.Title } -

- } - if len(data.Members) > 0 { -
- for _, m := range data.Members { -
- if m.Photo != "" { - { - } else { - - } -
{ m.Name }
- if m.Role != "" { -
{ m.Role }
- } - if m.Bio != "" { -

{ m.Bio }

- } - if m.LinkedIn != "" { -
- LinkedIn -
- } -
- } -
- } else { -

No team members configured.

- } -
-
-} - -func leadershipGridPhotoAlt(m LeadershipGridMember) string { - if m.Name != "" { - return m.Name - } - return "Team member portrait" -} diff --git a/leadership_grid_templ.go b/leadership_grid_templ.go deleted file mode 100644 index 6585f2e..0000000 --- a/leadership_grid_templ.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// leadershipGridComponent renders the corporate-modernist:leadership_grid block. -func leadershipGridComponent(data LeadershipGridData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `leadership_grid.templ`, Line: 9, Col: 52} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(data.Members) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, m := range data.Members { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if m.Photo != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(m.Name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `leadership_grid.templ`, Line: 21, Col: 97} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if m.Role != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(m.Role) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `leadership_grid.templ`, Line: 23, Col: 72} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if m.Bio != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(m.Bio) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `leadership_grid.templ`, Line: 26, Col: 104} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if m.LinkedIn != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "

No team members configured.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func leadershipGridPhotoAlt(m LeadershipGridMember) string { - if m.Name != "" { - return m.Name - } - return "Team member portrait" -} - -var _ = templruntime.GeneratedTemplate diff --git a/logo_strip.go b/logo_strip.go deleted file mode 100644 index a83d2fc..0000000 --- a/logo_strip.go +++ /dev/null @@ -1,55 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// LogoStripMeta is the block metadata for corporate-modernist:logo_strip. -var LogoStripMeta = blocks.BlockMeta{ - Key: "logo_strip", - Title: "Client Logo Strip", - Description: "Row of client logos, greyscale until hover.", - Source: "corporate-modernist", - Category: blocks.CategoryContent, -} - -// LogoStripItem represents a single logo entry in the strip. -type LogoStripItem struct { - Src string - Alt string - Href string -} - -// LogoStripData carries the parsed content for the logo_strip block. -type LogoStripData struct { - Caption string - Logos []LogoStripItem -} - -// LogoStripBlock renders the logo_strip block. -func LogoStripBlock(ctx context.Context, content map[string]any) string { - rawLogos := getSlice(content, "logos") - logos := make([]LogoStripItem, 0, len(rawLogos)) - for _, l := range rawLogos { - alt := getString(l, "alt") - src := getString(l, "src") - href := getString(l, "href") - // Skip entries with no asset reference and no alt text. - if src == "" && alt == "" { - continue - } - logos = append(logos, LogoStripItem{Src: src, Alt: alt, Href: href}) - } - - data := LogoStripData{ - Caption: getString(content, "caption"), - Logos: logos, - } - - var buf bytes.Buffer - _ = logoStripComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/logo_strip.templ b/logo_strip.templ deleted file mode 100644 index ecf9ad3..0000000 --- a/logo_strip.templ +++ /dev/null @@ -1,44 +0,0 @@ -package main - -// logoStripComponent renders the corporate-modernist:logo_strip block. -templ logoStripComponent(data LogoStripData) { -
-
- if data.Caption != "" { -

{ data.Caption }

- } - if len(data.Logos) > 0 { -
- for _, logo := range data.Logos { - if logo.Href != "" { - - } else { - - } - } -
- } else { -

No client logos configured.

- } -
-
-} - -templ logoStripImage(logo LogoStripItem) { - if logo.Src != "" { - { - } else { - { logoStripAlt(logo) } - } -} - -func logoStripAlt(logo LogoStripItem) string { - if logo.Alt != "" { - return logo.Alt - } - return "Client logo" -} diff --git a/logo_strip_templ.go b/logo_strip_templ.go deleted file mode 100644 index 7039b8c..0000000 --- a/logo_strip_templ.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// logoStripComponent renders the corporate-modernist:logo_strip block. -func logoStripComponent(data LogoStripData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Caption != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Caption) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `logo_strip.templ`, Line: 8, Col: 92} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(data.Logos) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, logo := range data.Logos { - if logo.Href != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = logoStripImage(logo).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = logoStripImage(logo).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "

No client logos configured.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func logoStripImage(logo LogoStripItem) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - if logo.Src != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(logoStripAlt(logo)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `logo_strip.templ`, Line: 35, Col: 69} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -func logoStripAlt(logo LogoStripItem) string { - if logo.Alt != "" { - return logo.Alt - } - return "Client logo" -} - -var _ = templruntime.GeneratedTemplate diff --git a/main.go b/main.go deleted file mode 100644 index 6341469..0000000 --- a/main.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build wasip1 - -// Package main compiles the corporate-modernist theme to a wasip1 reactor-mode wasm guest -// (WO-WZ-015). The .so build path is retired; `ninja plugin build` produces the -// .bnp artifact the registry serves. -// -// Reactor mode: the host runs `_initialize` once per pooled instance, which -// runs this init func (hence wasmguest.Serve) before any bn_invoke. Serve is -// non-blocking; all theme work then arrives over the ABI hook calls. main is -// never called. -package main - -import "git.dev.alexdunmow.com/block/core/plugin/wasmguest" - -func init() { wasmguest.Serve(Registration) } - -func main() {} // never called — reactor mode diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..1d9ea5b --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,85 @@ +# Corporate Modernist theme — codeless .bnp manifest (WO-WZ-021 Phase B). +# Synthesized into manifest.pb by `ninja plugin build` (no plugin.wasm). +theme_presets: presets.json +bundled_fonts: fonts.json +master_pages: master_pages.json + +system_templates: + - key: corporate-modernist + title: Corporate Modernist + description: "Swiss-grid B2B theme with restrained typography, a single configurable accent, and trust-signal blocks for enterprise sites." + +page_templates: + - system: corporate-modernist + key: default + title: Default + description: "Header + 12-col main + footer, capped at 1280px." + slots: [header, main, footer] + - system: corporate-modernist + key: landing + title: Landing + description: "Hero band + main + closing CTA + footer." + slots: [hero, main, cta, footer] + - system: corporate-modernist + key: article + title: Article + description: "Centered measure for long-form thought leadership." + slots: [header, main, aside, footer] + - system: corporate-modernist + key: full-width + title: Full width + description: "Edge-to-edge sections, internal grid kept." + slots: [header, main, footer] + +template_overrides: + - { template: corporate-modernist, block: heading } + - { template: corporate-modernist, block: text } + - { template: corporate-modernist, block: button } + - { template: corporate-modernist, block: card } + +email_wrappers: + - corporate-modernist + +css: + input_css_append: | + /* Corporate Modernist — appended utility CSS. */ + .cm-content-well { width: 100%; max-width: 1280px; margin-left: auto; margin-right: auto; padding-left: 1.5rem; padding-right: 1.5rem; box-sizing: border-box; } + .cm-swiss-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 1.5rem; row-gap: 1.5rem; } + .cm-hairline { border-color: hsl(var(--border)); border-width: 1px; border-style: solid; } + .cm-hairline-top { border-top: 1px solid hsl(var(--border)); } + .cm-hairline-bottom { border-bottom: 1px solid hsl(var(--border)); } + .numeric-tabular { font-variant-numeric: tabular-nums; } + .cm-display { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 600; letter-spacing: -0.02em; } + .cm-body { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; font-variant-numeric: tabular-nums; } + .cm-mono { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; } + .cm-accent-rule { border-top: 2px solid hsl(var(--accent)); } + .cm-btn-primary { display: inline-block; padding: 0.625rem 1.25rem; background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); border: 1px solid hsl(var(--accent)); border-radius: 4px; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 500; text-decoration: none; line-height: 1.4; box-shadow: none; background-image: none; transition: background-color 150ms ease; } + .cm-btn-primary:hover { background-color: hsl(var(--accent) / 0.9); } + .cm-btn-primary:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; } + .cm-btn-outline { display: inline-block; padding: 0.625rem 1.25rem; background-color: transparent; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); border-radius: 4px; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 500; text-decoration: none; line-height: 1.4; box-shadow: none; background-image: none; transition: border-color 150ms ease; } + .cm-btn-outline:hover { border-color: hsl(var(--foreground)); } + .cm-btn-outline:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; } + .cm-card { background-color: hsl(var(--card)); color: hsl(var(--card-foreground)); border: 1px solid hsl(var(--border)); border-radius: 4px; padding: 1.5rem; box-shadow: none; } + .cm-card.cm-card-accent { border-top: 2px solid hsl(var(--accent)); } + .cm-heading { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-weight: 600; letter-spacing: -0.02em; color: hsl(var(--foreground)); margin: 0; } + .cm-heading-h2-accent { border-bottom: 2px solid hsl(var(--accent)); padding-bottom: 0.25rem; display: inline-block; } + .cm-text { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; color: hsl(var(--foreground)); font-variant-numeric: tabular-nums; hanging-punctuation: first last; } + .cm-logo { filter: grayscale(1); opacity: 0.7; transition: filter 200ms ease, opacity 200ms ease; } + .cm-logo:hover { filter: grayscale(0); opacity: 1; } + .cm-pull-quote { border-top: 2px solid hsl(var(--accent)); padding-top: 1.25rem; font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-size: 1.5rem; line-height: 1.4; font-weight: 500; color: hsl(var(--foreground)); } + .cm-metric { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-size: 3rem; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; color: hsl(var(--accent)); } + .cm-stat-figure { font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace); font-size: 2.5rem; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; color: hsl(var(--foreground)); } + .cm-stat-label { font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 0.875rem; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem; } + .cm-eyebrow { font-family: var(--font-heading, "Inter Tight", "Inter", system-ui, sans-serif); font-size: 0.875rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: hsl(var(--accent)); margin-bottom: 1rem; } + .cm-cta-strip-accent { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); } + .cm-cta-strip-accent .cm-btn-primary { background-color: hsl(var(--accent-foreground)); color: hsl(var(--accent)); border-color: hsl(var(--accent-foreground)); } + .cm-cta-strip-quiet { background-color: hsl(var(--muted)); color: hsl(var(--foreground)); } + .cm-footer { background-color: hsl(var(--background)); color: hsl(var(--foreground)); border-top: 1px solid hsl(var(--border)); padding: 3rem 0; } + .cm-footer-legal { color: hsl(var(--muted-foreground)); font-size: 0.875rem; border-top: 1px solid hsl(var(--border)); padding-top: 1.5rem; margin-top: 2rem; } + .cm-leadership-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1.5rem; } + @media (min-width: 640px) { .cm-leadership-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } } + @media (min-width: 1024px) { .cm-leadership-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } } + @media (min-width: 1280px) { .cm-leadership-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } } + .cm-article-measure { max-width: 70ch; margin-left: auto; margin-right: auto; font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 17px; line-height: 28px; color: hsl(var(--foreground)); } + .cm-section { padding-top: 4rem; padding-bottom: 4rem; } + .cm-img-empty { display: block; width: 100%; aspect-ratio: 4 / 3; background-color: hsl(var(--muted)); border: 1px solid hsl(var(--border)); } diff --git a/master_pages.json b/master_pages.json new file mode 100644 index 0000000..355fae8 --- /dev/null +++ b/master_pages.json @@ -0,0 +1,24 @@ +[ + { + "key": "corporate-modernist:default-master", + "title": "Corporate Modernist Default Master", + "page_templates": ["default", "article"], + "blocks": [ + { "block_key": "navbar", "title": "Main Navigation", "content": { "menuName": "main", "style": "underline" }, "slot": "header", "sort_order": 0 }, + { "block_key": "slot", "title": "Main Content Slot", "content": { "slotName": "main" }, "slot": "main", "sort_order": 0 }, + { "block_key": "corporate-modernist:footer", "title": "Site Footer", "content": { "variant": "compact", "showLegal": true }, "slot": "footer", "sort_order": 0 } + ] + }, + { + "key": "corporate-modernist:landing-master", + "title": "Corporate Modernist Landing Master", + "page_templates": ["landing", "full-width"], + "blocks": [ + { "block_key": "navbar", "title": "Main Navigation", "content": { "menuName": "main", "style": "underline" }, "slot": "header", "sort_order": 0 }, + { "block_key": "corporate-modernist:hero_statement", "title": "Landing Hero", "content": { "eyebrow": "Enterprise", "headline": "Trusted by 200+ boards" }, "slot": "hero", "sort_order": 0 }, + { "block_key": "slot", "title": "Main Content Slot", "content": { "slotName": "main" }, "slot": "main", "sort_order": 0 }, + { "block_key": "corporate-modernist:cta_strip", "title": "Closing CTA", "content": { "variant": "book-call" }, "slot": "cta", "sort_order": 0 }, + { "block_key": "corporate-modernist:footer", "title": "Site Footer", "content": { "variant": "full", "showLegal": true }, "slot": "footer", "sort_order": 0 } + ] + } +] diff --git a/plugin.mod b/plugin.mod index 4f58885..ddde486 100644 --- a/plugin.mod +++ b/plugin.mod @@ -2,11 +2,8 @@ name = "corporate-modernist" display_name = "Corporate Modernist" scope = "@themes" -version = "0.1.2" +version = "0.2.0" description = "Swiss-grid B2B theme with restrained typography, a single configurable accent, and trust-signal blocks for enterprise sites." kind = "theme" categories = ["templates"] tags = ["business", "corporate", "enterprise", "consulting", "legal", "professional", "b2b", "swiss"] - -[compatibility] -block_core = ">=0.15.0 <0.16.0" diff --git a/register.go b/register.go deleted file mode 100644 index 91b74ab..0000000 --- a/register.go +++ /dev/null @@ -1,169 +0,0 @@ -package main - -import ( - "context" - - "github.com/a-h/templ" - - "git.dev.alexdunmow.com/block/core/blocks" - "git.dev.alexdunmow.com/block/core/plugin" - "git.dev.alexdunmow.com/block/core/templates" -) - -// wrap adapts a templ-returning render func to templates.TemplateFunc. -func wrap(f func(ctx context.Context, doc map[string]any) templ.Component) templates.TemplateFunc { - return func(ctx context.Context, doc map[string]any) templates.HTMLComponent { - return f(ctx, doc) - } -} - -// Register wires Corporate Modernist's system template, page templates, -// theme-owned blocks, built-in overrides, and email wrapper. -// -// Schema loading must precede block registration so that the registry can -// bind schemas to block keys at runtime. -func Register(tr templates.TemplateRegistry, br blocks.BlockRegistry) error { - // 1. System template. - tr.RegisterSystemTemplate(templates.SystemTemplateMeta{ - Key: "corporate-modernist", - Title: "Corporate Modernist", - Description: "Swiss-grid B2B theme with restrained typography, a single configurable accent, and trust-signal blocks for enterprise sites.", - }) - - // 2. Page templates. - if err := tr.RegisterPageTemplate("corporate-modernist", templates.PageTemplateMeta{ - Key: "default", - Title: "Default", - Description: "Header + 12-col main + footer, capped at 1280px.", - Slots: []string{"header", "main", "footer"}, - }, wrap(RenderCM)); err != nil { - return err - } - if err := tr.RegisterPageTemplate("corporate-modernist", templates.PageTemplateMeta{ - Key: "landing", - Title: "Landing", - Description: "Hero band + main + closing CTA + footer.", - Slots: []string{"hero", "main", "cta", "footer"}, - }, wrap(RenderCMLanding)); err != nil { - return err - } - if err := tr.RegisterPageTemplate("corporate-modernist", templates.PageTemplateMeta{ - Key: "article", - Title: "Article", - Description: "Centered measure for long-form thought leadership.", - Slots: []string{"header", "main", "aside", "footer"}, - }, wrap(RenderCMArticle)); err != nil { - return err - } - if err := tr.RegisterPageTemplate("corporate-modernist", templates.PageTemplateMeta{ - Key: "full-width", - Title: "Full width", - Description: "Edge-to-edge sections, internal grid kept.", - Slots: []string{"header", "main", "footer"}, - }, wrap(RenderCMFullWidth)); err != nil { - return err - } - - // 3. Schemas — MUST precede block registrations. - if err := br.LoadSchemasFromFS(Schemas()); err != nil { - return err - } - - // 4. Theme-owned blocks. - br.Register(HeroStatementMeta, HeroStatementBlock) - br.Register(LogoStripMeta, LogoStripBlock) - br.Register(TestimonialQuoteMeta, TestimonialQuoteBlock) - br.Register(CaseStudyCardMeta, CaseStudyCardBlock) - br.Register(LeadershipGridMeta, LeadershipGridBlock) - br.Register(StatPairMeta, StatPairBlock) - br.Register(CTAStripMeta, CTAStripBlock) - br.Register(FooterMeta, FooterBlock) - - // 5. Built-in overrides — heading, text, button, card. - br.RegisterTemplateOverride("corporate-modernist", "heading", CorporateModernistHeadingBlock) - br.RegisterTemplateOverride("corporate-modernist", "text", CorporateModernistTextBlock) - br.RegisterTemplateOverride("corporate-modernist", "button", CorporateModernistButtonBlock) - br.RegisterTemplateOverride("corporate-modernist", "card", CorporateModernistCardBlock) - - // 6. Email wrapper. - tr.RegisterEmailWrapper("corporate-modernist", CorporateModernistEmailWrapper) - - return nil -} - -// DefaultMasterPages returns Corporate Modernist's two seeded master pages. -// Slot names match the page templates registered above. -func DefaultMasterPages() []plugin.MasterPageDefinition { - return []plugin.MasterPageDefinition{ - { - Key: "corporate-modernist:default-master", - Title: "Corporate Modernist Default Master", - PageTemplates: []string{"default", "article"}, - Blocks: []plugin.MasterPageBlock{ - { - BlockKey: "navbar", - Title: "Main Navigation", - Content: map[string]any{"menuName": "main", "style": "underline"}, - Slot: "header", - SortOrder: 0, - }, - { - BlockKey: "slot", - Title: "Main Content Slot", - Content: map[string]any{"slotName": "main"}, - Slot: "main", - SortOrder: 0, - }, - { - BlockKey: "corporate-modernist:footer", - Title: "Site Footer", - Content: map[string]any{"variant": "compact", "showLegal": true}, - Slot: "footer", - SortOrder: 0, - }, - }, - }, - { - Key: "corporate-modernist:landing-master", - Title: "Corporate Modernist Landing Master", - PageTemplates: []string{"landing", "full-width"}, - Blocks: []plugin.MasterPageBlock{ - { - BlockKey: "navbar", - Title: "Main Navigation", - Content: map[string]any{"menuName": "main", "style": "underline"}, - Slot: "header", - SortOrder: 0, - }, - { - BlockKey: "corporate-modernist:hero_statement", - Title: "Landing Hero", - Content: map[string]any{"eyebrow": "Enterprise", "headline": "Trusted by 200+ boards"}, - Slot: "hero", - SortOrder: 0, - }, - { - BlockKey: "slot", - Title: "Main Content Slot", - Content: map[string]any{"slotName": "main"}, - Slot: "main", - SortOrder: 0, - }, - { - BlockKey: "corporate-modernist:cta_strip", - Title: "Closing CTA", - Content: map[string]any{"variant": "book-call"}, - Slot: "cta", - SortOrder: 0, - }, - { - BlockKey: "corporate-modernist:footer", - Title: "Site Footer", - Content: map[string]any{"variant": "full", "showLegal": true}, - Slot: "footer", - SortOrder: 0, - }, - }, - }, - } -} diff --git a/registration.go b/registration.go deleted file mode 100644 index 024ecdd..0000000 --- a/registration.go +++ /dev/null @@ -1,34 +0,0 @@ -package main - -import ( - "io/fs" - "net/http" - - "git.dev.alexdunmow.com/block/core/blocks" - "git.dev.alexdunmow.com/block/core/plugin" - "git.dev.alexdunmow.com/block/core/templates" -) - -// Registration is the compile-time plugin registration for the Corporate Modernist theme. -var Registration = plugin.PluginRegistration{ - Name: "corporate-modernist", - Version: plugin.ParseModVersion(pluginModBytes), - Register: func(tr templates.TemplateRegistry, br blocks.BlockRegistry) error { - return Register(tr, br) - }, - Assets: func() http.Handler { return AssetsHandler() }, - Schemas: func() fs.FS { return Schemas() }, - ThemePresets: func() []byte { return ThemePresets() }, - BundledFonts: func() []byte { return BundledFonts() }, - MasterPages: func() []plugin.MasterPageDefinition { return DefaultMasterPages() }, - CSSManifest: func() *plugin.CSSManifest { return cssManifest() }, -} - -// cssManifest exposes Corporate Modernist's utility CSS to the host Tailwind input -// so .cm-* classes resolve in production builds. No @font-face declarations here: -// the CMS emits those from fonts.json (currently []). -func cssManifest() *plugin.CSSManifest { - return &plugin.CSSManifest{ - InputCSSAppend: corporateModernistUtilityCSS, - } -} diff --git a/stat_pair.go b/stat_pair.go deleted file mode 100644 index 2fb508b..0000000 --- a/stat_pair.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// StatPairMeta is the block metadata for corporate-modernist:stat_pair. -var StatPairMeta = blocks.BlockMeta{ - Key: "stat_pair", - Title: "Stat Pair", - Description: "Row of mono-numeral statistics separated by a hairline rule.", - Source: "corporate-modernist", - Category: blocks.CategoryContent, -} - -// StatPairItem represents a single stat entry. -type StatPairItem struct { - Figure string - Label string - Source string -} - -// StatPairData carries the parsed content for the stat_pair block. -type StatPairData struct { - Title string - Stats []StatPairItem -} - -// StatPairBlock renders the stat_pair block. -func StatPairBlock(ctx context.Context, content map[string]any) string { - rawStats := getSlice(content, "stats") - stats := make([]StatPairItem, 0, len(rawStats)) - for _, s := range rawStats { - figure := getString(s, "figure") - if figure == "" { - continue - } - stats = append(stats, StatPairItem{ - Figure: figure, - Label: getString(s, "label"), - Source: getString(s, "source"), - }) - } - - data := StatPairData{ - Title: getString(content, "title"), - Stats: stats, - } - - var buf bytes.Buffer - _ = statPairComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/stat_pair.templ b/stat_pair.templ deleted file mode 100644 index 8d19d78..0000000 --- a/stat_pair.templ +++ /dev/null @@ -1,45 +0,0 @@ -package main - -// statPairComponent renders the corporate-modernist:stat_pair block. -templ statPairComponent(data StatPairData) { -
-
- if data.Title != "" { -

- { data.Title } -

- } - if len(data.Stats) > 0 { -
- for _, s := range data.Stats { -
-
{ s.Figure }
- if s.Label != "" { -
{ s.Label }
- } - if s.Source != "" { -
{ s.Source }
- } -
- } -
- } else { -

No statistics configured.

- } -
-
-} - -// statPairColumnSpan picks a column span based on how many stats are configured. -func statPairColumnSpan(count int) string { - switch { - case count >= 4: - return "grid-column: span 3 / span 3;" - case count == 3: - return "grid-column: span 4 / span 4;" - case count == 2: - return "grid-column: span 6 / span 6;" - default: - return "grid-column: span 12 / span 12;" - } -} diff --git a/stat_pair_templ.go b/stat_pair_templ.go deleted file mode 100644 index 1c55f58..0000000 --- a/stat_pair_templ.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// statPairComponent renders the corporate-modernist:stat_pair block. -func statPairComponent(data StatPairData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Title != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `stat_pair.templ`, Line: 9, Col: 52} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if len(data.Stats) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for _, s := range data.Stats { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(s.Figure) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `stat_pair.templ`, Line: 16, Col: 100} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if s.Label != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(s.Label) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `stat_pair.templ`, Line: 18, Col: 44} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if s.Source != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(s.Source) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `stat_pair.templ`, Line: 21, Col: 129} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "

No statistics configured.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// statPairColumnSpan picks a column span based on how many stats are configured. -func statPairColumnSpan(count int) string { - switch { - case count >= 4: - return "grid-column: span 3 / span 3;" - case count == 3: - return "grid-column: span 4 / span 4;" - case count == 2: - return "grid-column: span 6 / span 6;" - default: - return "grid-column: span 12 / span 12;" - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/template.templ b/template.templ deleted file mode 100644 index b56baea..0000000 --- a/template.templ +++ /dev/null @@ -1,274 +0,0 @@ -package main - -import ( - "context" - - "git.dev.alexdunmow.com/block/core/templates/bn" -) - -// PageData captures parsed template data for the Corporate Modernist page renderers. -type PageData struct { - Title string - Slots map[string]string - ThemeMode string - ThemeCSS string - SiteSettings bn.SiteSettingsData - PageMeta bn.PageMeta - StructuredData string - CSSHash string - PageviewNonce string - EngagementConfig bn.EngagementConfig -} - -// parseCMPageData adapts the runtime doc map into PageData. -func parseCMPageData(doc map[string]any) PageData { - title := "Untitled" - if t, ok := doc["title"].(string); ok { - title = t - } - - slots := make(map[string]string) - if s, ok := doc["slots"].(map[string]string); ok { - slots = s - } - - themeCSS := "" - if tc, ok := doc["theme_css"].(string); ok { - themeCSS = tc - } - - structuredData := "" - if sd, ok := doc["structured_data"].(string); ok { - structuredData = sd - } - - cssHash := "" - if ch, ok := doc["css_hash"].(string); ok { - cssHash = ch - } - - pageviewNonce := "" - if pn, ok := doc["pageview_nonce"].(string); ok { - pageviewNonce = pn - } - - themeMode := "light" - if tm, ok := doc["theme_mode"].(string); ok && tm != "" { - themeMode = tm - } - - return PageData{ - Title: title, - Slots: slots, - ThemeMode: themeMode, - ThemeCSS: themeCSS, - SiteSettings: bn.ParseSiteSettings(doc), - PageMeta: bn.ParsePageMeta(doc), - StructuredData: structuredData, - CSSHash: cssHash, - PageviewNonce: pageviewNonce, - EngagementConfig: bn.ParseEngagementConfig(doc), - } -} - -// pluginStyles points at the embedded plugin CSS served via /templates//style.css. -func pluginStyles() []string { - return []string{"/templates/corporate-modernist/style.css"} -} - -// Default — header + 12-col main + footer, capped at 1280px. -templ CorporateModernistDefault(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
-
- @templ.Raw(data.Slots["header"]) -
-
-
-
-
- if main, ok := data.Slots["main"]; ok && main != "" { - @templ.Raw(main) - } else { -

No content blocks assigned to this page.

- } -
-
-
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// Landing — hero band + main + closing CTA + footer. -templ CorporateModernistLanding(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
-
- @templ.Raw(data.Slots["header"]) -
-
-
- @templ.Raw(data.Slots["hero"]) -
-
- if main, ok := data.Slots["main"]; ok && main != "" { -
-
-
- @templ.Raw(main) -
-
-
- } -
-
- @templ.Raw(data.Slots["cta"]) -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// Article — centered measure for long-form thought leadership. -templ CorporateModernistArticle(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
-
- @templ.Raw(data.Slots["header"]) -
-
-
-
-
- if main, ok := data.Slots["main"]; ok && main != "" { - @templ.Raw(main) - } else { -

No article content yet.

- } -
-
- if aside, ok := data.Slots["aside"]; ok && aside != "" { - - } -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// Full width — edge-to-edge sections, internal grid kept. -templ CorporateModernistFullWidth(data PageData) { - - - @bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }) - - @bn.AdminBypassBanner(data.SiteSettings) -
-
- @templ.Raw(data.Slots["header"]) -
-
-
- if main, ok := data.Slots["main"]; ok && main != "" { - @templ.Raw(main) - } else { -
-

No content blocks assigned to this page.

-
- } -
-
- @templ.Raw(data.Slots["footer"]) -
- @bn.BodyEnd(data.SiteSettings) - - -} - -// RenderCM is the page-template render entry point for `default`. -func RenderCM(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistDefault(parseCMPageData(doc)) -} - -// RenderCMLanding is the page-template render entry point for `landing`. -func RenderCMLanding(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistLanding(parseCMPageData(doc)) -} - -// RenderCMArticle is the page-template render entry point for `article`. -func RenderCMArticle(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistArticle(parseCMPageData(doc)) -} - -// RenderCMFullWidth is the page-template render entry point for `full-width`. -func RenderCMFullWidth(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistFullWidth(parseCMPageData(doc)) -} diff --git a/template_templ.go b/template_templ.go deleted file mode 100644 index d2fd33c..0000000 --- a/template_templ.go +++ /dev/null @@ -1,528 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "context" - - "git.dev.alexdunmow.com/block/core/templates/bn" -) - -// PageData captures parsed template data for the Corporate Modernist page renderers. -type PageData struct { - Title string - Slots map[string]string - ThemeMode string - ThemeCSS string - SiteSettings bn.SiteSettingsData - PageMeta bn.PageMeta - StructuredData string - CSSHash string - PageviewNonce string - EngagementConfig bn.EngagementConfig -} - -// parseCMPageData adapts the runtime doc map into PageData. -func parseCMPageData(doc map[string]any) PageData { - title := "Untitled" - if t, ok := doc["title"].(string); ok { - title = t - } - - slots := make(map[string]string) - if s, ok := doc["slots"].(map[string]string); ok { - slots = s - } - - themeCSS := "" - if tc, ok := doc["theme_css"].(string); ok { - themeCSS = tc - } - - structuredData := "" - if sd, ok := doc["structured_data"].(string); ok { - structuredData = sd - } - - cssHash := "" - if ch, ok := doc["css_hash"].(string); ok { - cssHash = ch - } - - pageviewNonce := "" - if pn, ok := doc["pageview_nonce"].(string); ok { - pageviewNonce = pn - } - - themeMode := "light" - if tm, ok := doc["theme_mode"].(string); ok && tm != "" { - themeMode = tm - } - - return PageData{ - Title: title, - Slots: slots, - ThemeMode: themeMode, - ThemeCSS: themeCSS, - SiteSettings: bn.ParseSiteSettings(doc), - PageMeta: bn.ParsePageMeta(doc), - StructuredData: structuredData, - CSSHash: cssHash, - PageviewNonce: pageviewNonce, - EngagementConfig: bn.ParseEngagementConfig(doc), - } -} - -// pluginStyles points at the embedded plugin CSS served via /templates//style.css. -func pluginStyles() []string { - return []string{"/templates/corporate-modernist/style.css"} -} - -// Default — header + 12-col main + footer, capped at 1280px. -func CorporateModernistDefault(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "

No content blocks assigned to this page.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// Landing — hero band + main + closing CTA + footer. -func CorporateModernistLanding(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["hero"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["cta"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// Article — centered measure for long-form thought leadership. -func CorporateModernistArticle(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "

No article content yet.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if aside, ok := data.Slots["aside"]; ok && aside != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// Full width — edge-to-edge sections, internal grid kept. -func CorporateModernistFullWidth(data PageData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.Head(bn.HeadData{ - Title: data.Title, - Settings: data.SiteSettings, - PageMeta: data.PageMeta, - ThemeMode: data.ThemeMode, - ThemeCSS: data.ThemeCSS, - PluginStyles: pluginStyles(), - StructuredData: data.StructuredData, - CSSHash: data.CSSHash, - PageviewNonce: data.PageviewNonce, - EngagementConfig: data.EngagementConfig, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.AdminBypassBanner(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["header"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if main, ok := data.Slots["main"]; ok && main != "" { - templ_7745c5c3_Err = templ.Raw(main).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

No content blocks assigned to this page.

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(data.Slots["footer"]).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = bn.BodyEnd(data.SiteSettings).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -// RenderCM is the page-template render entry point for `default`. -func RenderCM(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistDefault(parseCMPageData(doc)) -} - -// RenderCMLanding is the page-template render entry point for `landing`. -func RenderCMLanding(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistLanding(parseCMPageData(doc)) -} - -// RenderCMArticle is the page-template render entry point for `article`. -func RenderCMArticle(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistArticle(parseCMPageData(doc)) -} - -// RenderCMFullWidth is the page-template render entry point for `full-width`. -func RenderCMFullWidth(ctx context.Context, doc map[string]any) templ.Component { - return CorporateModernistFullWidth(parseCMPageData(doc)) -} - -var _ = templruntime.GeneratedTemplate diff --git a/templates/corporate-modernist/article.ninjatpl b/templates/corporate-modernist/article.ninjatpl new file mode 100644 index 0000000..6adcc5b --- /dev/null +++ b/templates/corporate-modernist/article.ninjatpl @@ -0,0 +1,20 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
+
{{ slots.header|safe }}
+
+
+
+
+ {% if slots.main %}{{ slots.main|safe }}{% else %}

No article content yet.

{% endif %} +
+
+ {% if slots.aside %}{% endif %} +
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/corporate-modernist/default.ninjatpl b/templates/corporate-modernist/default.ninjatpl new file mode 100644 index 0000000..328cdb5 --- /dev/null +++ b/templates/corporate-modernist/default.ninjatpl @@ -0,0 +1,19 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
+
{{ slots.header|safe }}
+
+
+
+
+ {% if slots.main %}{{ slots.main|safe }}{% else %}

No content blocks assigned to this page.

{% endif %} +
+
+
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/corporate-modernist/full-width.ninjatpl b/templates/corporate-modernist/full-width.ninjatpl new file mode 100644 index 0000000..2db37bf --- /dev/null +++ b/templates/corporate-modernist/full-width.ninjatpl @@ -0,0 +1,15 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
+
{{ slots.header|safe }}
+
+
+ {% if slots.main %}{{ slots.main|safe }}{% else %}

No content blocks assigned to this page.

{% endif %} +
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/corporate-modernist/landing.ninjatpl b/templates/corporate-modernist/landing.ninjatpl new file mode 100644 index 0000000..97f9733 --- /dev/null +++ b/templates/corporate-modernist/landing.ninjatpl @@ -0,0 +1,17 @@ + + +{{ head_html|safe }} + + {{ admin_banner_html|safe }} +
+
{{ slots.header|safe }}
+
+
{{ slots.hero|safe }}
+
+ {% if slots.main %}
{{ slots.main|safe }}
{% endif %} +
+
{{ slots.cta|safe }}
+
{{ slots.footer|safe }}
+ {{ body_end_html|safe }} + + diff --git a/templates/email/corporate-modernist.ninjatpl b/templates/email/corporate-modernist.ninjatpl new file mode 100644 index 0000000..48c2f03 --- /dev/null +++ b/templates/email/corporate-modernist.ninjatpl @@ -0,0 +1,62 @@ + + + + + + + + {{ site_name }} + + + + {% if preview_text %}
{{ preview_text }}
{% endif %} + + + + +
+ + + + + + + + + + + + + + + + + +
+ + diff --git a/templates/overrides/corporate-modernist/button.ninjatpl b/templates/overrides/corporate-modernist/button.ninjatpl new file mode 100644 index 0000000..d0c818b --- /dev/null +++ b/templates/overrides/corporate-modernist/button.ninjatpl @@ -0,0 +1 @@ +{% if variant|default:"primary" == "outline" or variant|default:"primary" == "secondary" %}{{ label|default:text|default:"Learn more" }}{% else %}{{ label|default:text|default:"Learn more" }}{% endif %} diff --git a/templates/overrides/corporate-modernist/card.ninjatpl b/templates/overrides/corporate-modernist/card.ninjatpl new file mode 100644 index 0000000..c32942e --- /dev/null +++ b/templates/overrides/corporate-modernist/card.ninjatpl @@ -0,0 +1 @@ +
{% if title %}
{{ title }}
{% endif %}{% if body|default:text %}
{{ body|default:text|safe }}
{% endif %}
diff --git a/templates/overrides/corporate-modernist/heading.ninjatpl b/templates/overrides/corporate-modernist/heading.ninjatpl new file mode 100644 index 0000000..289b6ab --- /dev/null +++ b/templates/overrides/corporate-modernist/heading.ninjatpl @@ -0,0 +1 @@ +{% if level|integer == 1 %}

{{ text }}

{% elif level|integer == 3 %}

{{ text }}

{% elif level|integer == 4 %}

{{ text }}

{% elif level|integer == 5 %}
{{ text }}
{% elif level|integer == 6 %}
{{ text }}
{% else %}

{{ text }}

{% endif %} diff --git a/templates/overrides/corporate-modernist/text.ninjatpl b/templates/overrides/corporate-modernist/text.ninjatpl new file mode 100644 index 0000000..6db3dad --- /dev/null +++ b/templates/overrides/corporate-modernist/text.ninjatpl @@ -0,0 +1 @@ +
{{ text|safe }}
diff --git a/testimonial_quote.go b/testimonial_quote.go deleted file mode 100644 index 06207a7..0000000 --- a/testimonial_quote.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "bytes" - "context" - - "git.dev.alexdunmow.com/block/core/blocks" -) - -// TestimonialQuoteMeta is the block metadata for corporate-modernist:testimonial_quote. -var TestimonialQuoteMeta = blocks.BlockMeta{ - Key: "testimonial_quote", - Title: "Testimonial", - Description: "Pull-quote testimonial with attribution, headshot, and company mark.", - Source: "corporate-modernist", - Category: blocks.CategoryContent, -} - -// TestimonialQuoteData carries the parsed content for the testimonial_quote block. -type TestimonialQuoteData struct { - Quote string - Name string - Role string - Company string - Headshot string - Logo string -} - -// TestimonialQuoteBlock renders the testimonial_quote block. -func TestimonialQuoteBlock(ctx context.Context, content map[string]any) string { - data := TestimonialQuoteData{ - Quote: getString(content, "quote"), - Name: getString(content, "name"), - Role: getString(content, "role"), - Company: getString(content, "company"), - Headshot: getString(content, "headshot"), - Logo: getString(content, "logo"), - } - - var buf bytes.Buffer - _ = testimonialQuoteComponent(data).Render(ctx, &buf) - return buf.String() -} diff --git a/testimonial_quote.templ b/testimonial_quote.templ deleted file mode 100644 index e12ba74..0000000 --- a/testimonial_quote.templ +++ /dev/null @@ -1,63 +0,0 @@ -package main - -// testimonialQuoteComponent renders the corporate-modernist:testimonial_quote block. -templ testimonialQuoteComponent(data TestimonialQuoteData) { -
-
-
- if data.Quote != "" { -
- { data.Quote } -
- } else { -
- No testimonial provided. -
- } -
- if data.Headshot != "" { - { - } else { - - } -
- if data.Name != "" { -
{ data.Name }
- } - if data.Role != "" || data.Company != "" { -
{ testimonialQuoteAttribution(data) }
- } -
- if data.Logo != "" { - - } -
-
-
-
-} - -func testimonialQuoteHeadshotAlt(data TestimonialQuoteData) string { - if data.Name != "" { - return data.Name - } - return "Testimonial portrait" -} - -func testimonialQuoteLogoAlt(data TestimonialQuoteData) string { - if data.Company != "" { - return data.Company + " logo" - } - return "Company logo" -} - -func testimonialQuoteAttribution(data TestimonialQuoteData) string { - switch { - case data.Role != "" && data.Company != "": - return data.Role + ", " + data.Company - case data.Role != "": - return data.Role - default: - return data.Company - } -} diff --git a/testimonial_quote_templ.go b/testimonial_quote_templ.go deleted file mode 100644 index 6951230..0000000 --- a/testimonial_quote_templ.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// testimonialQuoteComponent renders the corporate-modernist:testimonial_quote block. -func testimonialQuoteComponent(data TestimonialQuoteData) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Quote != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.Quote) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `testimonial_quote.templ`, Line: 10, Col: 18} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
No testimonial provided.
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Headshot != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Name != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.Name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `testimonial_quote.templ`, Line: 25, Col: 96} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - if data.Role != "" || data.Company != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(testimonialQuoteAttribution(data)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `testimonial_quote.templ`, Line: 28, Col: 100} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if data.Logo != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\"")") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func testimonialQuoteHeadshotAlt(data TestimonialQuoteData) string { - if data.Name != "" { - return data.Name - } - return "Testimonial portrait" -} - -func testimonialQuoteLogoAlt(data TestimonialQuoteData) string { - if data.Company != "" { - return data.Company + " logo" - } - return "Company logo" -} - -func testimonialQuoteAttribution(data TestimonialQuoteData) string { - switch { - case data.Role != "" && data.Company != "": - return data.Role + ", " + data.Company - case data.Role != "": - return data.Role - default: - return data.Company - } -} - -var _ = templruntime.GeneratedTemplate diff --git a/text_override.go b/text_override.go deleted file mode 100644 index 7dcf903..0000000 --- a/text_override.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "bytes" - "context" -) - -// CorporateModernistTextBlock renders the built-in `text` block with -// Inter at 17/28, tabular figures, and hanging punctuation. -func CorporateModernistTextBlock(ctx context.Context, content map[string]any) string { - text := getString(content, "text") - class := getString(content, "class") - - var buf bytes.Buffer - _ = textOverrideComponent(text, class).Render(ctx, &buf) - return buf.String() -} diff --git a/text_override.templ b/text_override.templ deleted file mode 100644 index 020463f..0000000 --- a/text_override.templ +++ /dev/null @@ -1,8 +0,0 @@ -package main - -// textOverrideComponent renders the Corporate Modernist text override. -templ textOverrideComponent(text, class string) { -
- @templ.Raw(text) -
-} diff --git a/text_override_templ.go b/text_override_templ.go deleted file mode 100644 index 423d908..0000000 --- a/text_override_templ.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.1020 -package main - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -// textOverrideComponent renders the Corporate Modernist text override. -func textOverrideComponent(text, class string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - var templ_7745c5c3_Var2 = []any{"cm-text", class} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(text).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate