Files
co-lite/openspec/changes/archive/2026-12-03-add-page-sections/design.md
T

2.5 KiB

Context

Design: docs/superpowers/specs/2026-12-03-page-builder-design.md, change 1. Blocks are one JSON list per page, validated by CmsBlockValidator, passed through mobile-api as maps, rendered by LandingPage/Block in CmsBlocks.tsx, and edited by BlockFields.tsx.

Goals / Non-Goals

Goals: four new section types, a look per section, an optional hero image, form-editor support.

Non-Goals: the on-page editor and templates (changes 2 and 3); per-element colours or fonts.

Decisions

  1. One cards list for FEATURES, STEPS and TRUST: items {icon, title, text}. FEATURES uses all three (icon required, from a fixed list); STEPS uses title and text (numbered by position); TRUST uses title only. Fields a type does not use are refused, so stored JSON stays clean. Limits: 2 to 6 cards, title 80, text 300.
  2. Icons are a fixed list of Lucide names: wifi, phone, tv, monitor, lock, shield-check, cloud, wrench, headset, users, calendar, star. The server checks the name; the portal maps names to components, so no icon markup is stored.
  3. CTA is heading (required), text (optional) and a button (required: a CTA without one has no purpose). Same link rule as other buttons.
  4. Look is an optional block field look: DEFAULT (or absent), MUTED, DARK, ACCENT. Any block type may carry it. Non-default looks render the block as a full-width band (background across the window, content in the usual width, vertical padding); ACCENT uses the company accent with contrastText for the text, falling back to the default primary colour. DEFAULT renders as today, so existing pages are unchanged.
  5. Hero image optional. A hero without an image already renders as plain text in the renderer; only the validator's requirement goes. A given image must still be the company's.
  6. Editor. Each new type gets an "Add …" button, its fields, and a card list with add/remove/move like FAQ items. The look picker is a select on every block.

Risks / Trade-offs

  • A Dark or Accent band right after another band of the same look merges visually → acceptable; staff see it in the preview.
  • HTML blocks ignore a look: a Custom HTML block is a full design of its own, so the editor does not offer the picker for it and the renderer draws no band.
  • Rollback: pages saved with new types must be edited before the previous release saves them; their new sections render as nothing under it.

Migration Plan

Deploy services-counter and the portal; run sql/01-section-labels.sql. Rollback: previous images and sql/99-rollback.sql.