Skip to content

refactor(rozier): migrate stories to convention - #553

Merged
timothejoubert merged 8 commits into
developfrom
feature/539-storybook-migration
Oct 30, 2026
Merged

timothejoubert merged 8 commits into
developfrom
feature/539-storybook-migration

Conversation

@timothejoubert

@timothejoubert timothejoubert commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of #539 — Phase 0 (#531), PR 2 of 3.

Applies the Storybook convention from #538 (lib/Rozier/docs/storybook.md, ADR 0004) to the existing stories. No new stories (PR 3), no component or runtime renderer change.

What changes

  • Tree: every title moves under Foundations/, Components/<Group>/ (Actions, Form, Overlay, Navigation, Data display, Feedback) or Patterns/; sub-components use <Parent>/Root + <Parent>/Item. Foundation files drop the Rz prefix, RzThemeSwitcher becomes RzColorSchemeSwitcher. Header is filed under Patterns/ as the tree requires.
  • Args: option types now live in their renderer (Rz<Name>Options). Renderers no longer import types from story files, and stories no longer import Args from each other. Changes in app/utils/storybook/renderer/ are type-only; app/utils/component-renderer/ is untouched.
  • Renderers: render is declared once in meta; stories vary through args, so controls drive every story. Values that were hard-coded inside per-story renders (Badge variants, Input min/max/checked, Link class, Tree child-nodes layout, Toast stack) are now args. Story-specific renders remain only for compositions fed by args.
  • Fixes: RzLivePreview.stories.ts imported a renderer that does not exist (Storybook build failed); additionalClasses, which no renderer reads, replaced by attributes.class; dead a11y parameter removed from .storybook/preview.ts.
  • ColorSchemeSwitcher: new storybook/renderer/rzColorSchemeSwitcher.ts replaces the hand-written markup and mirrors includes/rz_color_scheme_switcher.html.twig; the Header renderer now includes it, as admin/rz_header.html.twig does.
  • LivePreview: the story follows the new UI (.rz-page__body split view, toggle in rz-actions-menu) and renders each story in its own docs iframe.
  • Live preview breakpoint (backoffice): the split view and its toggle now show from 960px (--screen-md-min) instead of 1280px (--screen-lg-min), in rz-live-preview.css.
  • Story IDs change with the new titles (and a few renamed exports: Default first, *Drawer suffix dropped, PageHeader Item → ItemClasses).

Out of scope / follow-ups

  • Missing stories (rz-page, rz-bulk-section, …) and Patterns/Aside: PR 3.
  • RzPopover.stories.ts keeps a local popover renderer that duplicates storybook/renderer/rzPopover.ts with different options; merging them changes the story args, left for a follow-up.
  • FileUpload still has a dead iconClass arg.

Verification

  • pnpm lint, pnpm build:check, pnpm build-storybook pass (in the node container); before this branch build-storybook failed on the rzButton import. index.json lists 51 titles / 199 stories matching the tree in storybook.md.
  • To check by hand in both themes, using the controls:
    • Data display/Badge, EntityThumbnail (Loading, Error, Empty, size control)
    • Actions/Button (Live Classes Editing, lists), ColorSchemeSwitcher
    • Form/Input (Number, Checkbox), MarkdownEditor (toolbar buttons carry markdown-editor-button-h*), FileUpload, Repeatable
    • Navigation/Tree (Child Nodes, toggle childNodes)
    • Feedback/Toast (Stacked: first toast follows the controls)
    • Overlay/Dialog (With Form, Non Modal)
    • Patterns/LivePreview, Header (color scheme switcher), App
    • Backoffice: node-source edit page with live preview, between 960px and 1279px
    • Foundations/Colors, Icons, Typography/Text

Merge Danger

Door: two-way

Stories, Storybook renderers and Storybook config, plus one backoffice CSS change: the live preview breakpoint.

Blast Radius: Storybook — bookmarked story URLs break because story IDs change. Backoffice — on the node-source edit page of headless installations, the live preview toggle and split view now appear between 960px and 1279px, where they were hidden; the form shrinks to about 520px next to a 360px preview at 960px.

Timothe Joubert added 8 commits October 30, 2026 10:48
The story imported rzButton from app/utils/storybook/renderer/, which
does not exist, so build-storybook failed. Use the component renderer
with its current single options signature (tertiary/sm, as in
editSource.html.twig), declare the render once in meta, file the story
under Patterns/LivePreview and rename the first story to Default.
The a11y addon is not installed, so the parameter had no effect.
Apply lib/Rozier/docs/storybook.md to every story file:

- Titles follow the Foundations / Components/<Group> / Patterns tree;
  sub-components use <Parent>/Root and <Parent>/Item.
- Foundation files lose the RZ prefix (Colors, Text, FontFamily,
  Icons); RzThemeSwitcher becomes RzColorSchemeSwitcher.
- Story option types move into their renderer as Rz<Name>Options:
  renderers no longer import types from stories, stories no longer
  import Args from each other.
- render is declared once in meta; stories vary through args. Stories
  that hard-coded values in render now pass them as args (Badge,
  Input, Link, Tree child-nodes layout, Toast stack).
- First story is Default; app imports use ~/.
- Drop the RzEntityThumbnail side-effect import (registered globally)
  and options the renderers ignored (additionalClasses, extra render
  arguments), replaced by attributes.
@timothejoubert
timothejoubert merged commit 213f8eb into develop Oct 30, 2026
1 of 4 checks passed
@timothejoubert
timothejoubert deleted the feature/539-storybook-migration branch October 30, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant