3.1 KiB
3.1 KiB
Layout Patterns Layer
- Status:
completed - Owner:
codex - Date:
2026-03-25
Goal
Add a dedicated patterns layer inside @ai-ui/ui for reusable page and shell structures that
sit above base components: SidebarNav, PageHeader, AppShell, and PageFooter.
Scope
- In scope:
- create
packages/ui/src/patterns/ - implement
SidebarNav,PageHeader,AppShell, andPageFooter - export the new patterns from
@ai-ui/ui - add Storybook docs under
Patterns/* - refactor the revenue dashboard scene to consume the new patterns where they fit
- add focused tests for the public slot and state contract
- create
- Out of scope:
- splitting a second npm package for patterns
- adding router-aware or data-source-aware app shells
- replacing every existing layout composition across the repo in one slice
Constraints
- Keep
componentsas the lower layer and allowpatternsto depend oncomponents, not the reverse. - Follow
DESIGN.mdand reuse the existing token and motion system instead of inventing a separate layout skin. - Keep APIs compound and slot-oriented so different pages can restyle the same patterns.
- Use Storybook titles under
Patterns/*so the review surface reflects the new layer clearly.
Affected Surfaces
packages/ui/src/patternspackages/ui/src/index.tsapps/docs/src/patternsapps/docs/src/revenue-dashboard.stories.tsxdocs/exec-plans
Plan
- Create the new
patternsdirectory and implement the four shared layout patterns with stable slots and restrained variant surfaces. - Export the patterns from
@ai-ui/uiwithout moving the existing base components. - Add docs stories under
Patterns/*that explain when to use each pattern. - Refactor the revenue dashboard scene to consume
SidebarNav,PageHeader, andAppShell, and usePageFooterwhere it adds real value. - Add focused tests and run the narrowest useful validation suites.
Validation
pnpm --filter @ai-ui/ui test -- sidebar-nav page-header page-footer app-shellpnpm --filter @ai-ui/ui typecheckpnpm build:docs
Orchestration Task Sketch
T1: implement the newpatternslayer and exportsT2 -> T1: add docs stories for the four patternsT3 -> T2: refactor the revenue dashboard consumer and run focused validation
Status Log
2026-03-25 16:48started the patterns-layer slice after confirming the repo has component-internal headers and footers but no dedicated page-shell layer for shared layout structures2026-03-25 17:06implemented the newpackages/ui/src/patterns/layer withSidebarNav,PageHeader,PageFooter, andAppShell, then exported the new public surface from@ai-ui/ui2026-03-25 17:10added Storybook docs underPatterns/*and refactored the revenue dashboard scene to consume the new shell and page patterns2026-03-25 17:12validated exact new pattern tests, workspace typecheck, and Storybook production build; the broaderpnpm --filter @ai-ui/ui test -- ...entrypoint still pulls in unrelated in-flightcomboboxandcommandfailures from concurrent work