Repository navigation
feat(components): add ladle previews + standardize component library - #6
Merged
Merged
Conversation
Add @ladle/[email protected] (Vite 5 era, matches our toolchain) with: - .ladle/config.mjs — story glob, dedicated port, title; points Ladle at our own vite.config so the app's multi-entry build doesn't leak in. - .ladle/vite.config.ts — resolves the `@/` alias to src/ (Ladle relocates Vite's root, breaking vite-tsconfig-paths). - .ladle/i18n.ts — self-contained i18next with bundled en/fr resources, since the app loads locales over HTTP and Ladle has no backend. - .ladle/components.tsx — global decorator mirroring src/providers.tsx (NextUI + React Query + Helmet) plus a Router and i18n; maps Ladle's theme addon onto the `dark`/`light` class so stories render in both themes. - ladle / ladle:build scripts; gitignore the build/ output. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Document the atoms/molecules/organisms/templates classification, the per-tier barrel + named-export convention, props-typing rules, tailwind-variants usage, and when-to-wrap-NextUI guidance. This is the contract the Phase-2 reorg follows. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Move every component under src/components into atoms/ molecules/ organisms/ per DESIGN_SYSTEM.md, with a barrel index.ts per tier. Keep the cohesive icons/ (→ atoms/icons) and mapbox/ (→ organisms/mapbox) sub-modules intact. All moves use git mv so history is preserved; filenames stay kebab-case. - Standardize on named exports everywhere (drop every `export default`); rename SearchBox→MapSearch (avoids @mapbox SearchBox clash) and the misspelled EventMetaevent→EventMetadata. - App code (pages, layouts, App.tsx) imports from the tier barrels; inside src/components, components import each other by direct file path to avoid barrel import cycles (molecule↔organism) and TDZ bugs. - Keep event-panel/details/registration out of the organisms barrel so the event page's lazy import still code-splits (App chunk 1,476→1,214 kB; event-panel back in its own 263 kB chunk). - Update pages/event.tsx lazy import to map the named EventPanel to default. No behavioral or visual change; typecheck, lint, and build are green. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the hard-coded `uppercase font-bold` content class with a tv() definition exposing an `emphasis` variant (solid|subtle, default solid). This is the reference tailwind-variants usage promised in DESIGN_SYSTEM.md; behaviour is unchanged at existing call sites. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-locate a *.stories.tsx for every atom, molecule, and non-map organism (25 files) using Ladle's native args/controls; the global decorator's theme toggle covers light + dark. Map organisms (map, geocoder) get light, token-gated stories that render a notice without VITE_MAPBOX_ACCESSTOKEN. - Add src/mocks/events.ts: Event / EventSlim / EventImage fixtures typed against the zod-inferred types, with fixed dates for stable previews. - Event detail organisms (panel/details/registration) import by direct path since they're excluded from the organisms barrel. - Include .ladle in the Tailwind content globs so the decorator's utility classes are generated. pnpm typecheck and pnpm ladle:build are green (25 story chunks). Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add STORYBOOK.md (Ladle wiring, current story conventions, and the deferred plan to port WeMeditateWeb's StoryWrapper/StorySection/StoryGrid helpers). Point .claude/rules/components.md at DESIGN_SYSTEM.md + STORYBOOK.md, and fix stale post-reorg paths in the components/mapbox/code-style rules and CLAUDE.md (base/event/list → atoms/molecules/organisms; mapbox → organisms/mapbox; icons → atoms/icons). Document the ladle scripts. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add `pnpm ladle:build` to the CI gate so broken component stories fail the build, and extend tsconfig include to `.ladle` so the decorator/config are type-checked alongside the stories (which already live under src/). Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Share i18next namespaces + %{...} delimiters via src/config/i18n-options.ts
(consumed by the app instance and the Ladle story instance); fix
DESIGN_SYSTEM export-name drift + the props-typing rule; document chip's
emphasis variant; drop a stray search-bar console.log.
Refs #5
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The app's HTTP-backed i18next singleton can still initialize transitively in Ladle (via components/api importing @/config/i18n); stories nonetheless resolve text through the isolated bundled-resource instance. Make the comment accurate (per /code-review) rather than over-claiming the singleton is never touched. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying atlas-legacy with
|
| Latest commit: |
16149ba
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1d348979.syatlas.pages.dev |
| Branch Preview URL: | https://feat-ladle-component-library.syatlas.pages.dev |
…ateWeb)
Restructure src/components so each component lives in its own PascalCase
folder — <tier>/<Name>/{<Name>.tsx, <Name>.stories.tsx, index.ts} — matching
WeMeditateWeb's layout. Cohesive Icons/ and Mapbox/ sub-modules keep their
grouped files. All moves via git mv (history preserved); intra-component
imports target the component-folder path; tier barrels re-export the folders.
Also ignore build/ (Ladle's output dir) in eslint.config.js — without it,
`eslint .` after a `ladle:build` lints the generated bundles.
Docs updated to the new convention: code-style, DESIGN_SYSTEM, STORYBOOK,
CLAUDE, and the components/mapbox rules. typecheck, lint, build, ladle:build
all green.
Refs #5
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Resolve the export/typing inconsistencies surfaced while mirroring WeMeditate: - Rename generic component `Props` → `<Component>Props` where there's no name clash (Panel, SelectionDropdown, EventItem, ListHeader, ListItem, SearchBar, EventsList). Chip keeps `Props` (composes NextUI `ChipProps`). - Convert useLocale / useMapbox to named exports (use-theme already was), so hooks match the named-export convention; update all import sites. - Document the export-style + props-type conventions in code-style.md. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Bring our Ladle stories to parity with WeMeditateWeb: - Port the shared story helpers to src/components/ladle/ (StoryWrapper, StorySection, StoryGrid family), adjusting only Tailwind v4→v3 (bg-linear-to-b → bg-gradient-to-b). - Rewrite all 25 stories to one consolidated `Default: Story` built from the helpers (sections / grids / Minimal-Maximal subsections / inContext Examples, trailing <div/>, JSDoc, storyName, category titles) — no more Ladle args/argTypes controls or multiple named exports. - Story canvas is now always light (matching WeMeditate); dark previews are shown per-section via <StorySection theme="dark">, which applies the `dark` class so NextUI components there render dark. - Rewrite STORYBOOK.md to the adopted conventions; align .ladle/config.mjs. typecheck, lint, build, and ladle:build (25 story chunks) all green. Refs #5 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #5 — introduces Ladle for isolated component
previews and standardizes the component library around an atomic-design
taxonomy, mirroring the WeMeditateWeb methodology adapted to our NextUI + Mapbox
stack. NextUI v2 stays the primitive layer — this adds structure and
previews, with no visual redesign and no NextUI component rewritten/removed.
Built in reviewable commits (one per phase).
lint,typecheck,build, andladle:buildare all green; ran/simplifyand a/code-reviewsubagent passbefore opening.
What's in here (by phase)
@ladle/[email protected](the Vite 5–era release; Ladle 5 bundlesVite 6),
.ladle/{config.mjs,vite.config.ts,i18n.ts,components.tsx}, andladle/ladle:buildscripts. The global decorator mirrorssrc/providers.tsx(NextUI + React Query + Helmet) and adds a
MemoryRouter+ an<I18nextProvider>with bundled en/fr resources (the app loads locales over HTTP; Ladle has no
backend). Ladle's theme toggle is mapped onto the
dark/lightclass so everystory renders in both themes.
git mv, history preserved) intosrc/components/{atoms,molecules,organisms}/with a barrelindex.tsper tier;the cohesive
icons/(→atoms/icons) andmapbox/(→organisms/mapbox)sub-modules stay intact. Kebab-case filenames;
@/*imports.every
export default); app code imports from the tier barrels, whileintra-
componentsimports use direct file paths to avoid barrel cycles.chip.tsxnow drives its content styling withtv()(the documented reference implementation).
*.stories.tsxfor every atom, molecule, and non-maporganism (25 files) using native Ladle args/controls, plus
src/mocks/events.tsfixtures typed against the zod schemas. Map organisms get light, token-gated
stories.
DESIGN_SYSTEM.md(taxonomy + export/props/tv()/when-to-wrap rules)and
STORYBOOK.md(story conventions + the deferred WeMeditate helper-migrationplan).
.claude/rules/components.md(and the stale paths inmapbox.md,code-style.md,CLAUDE.md) now point at them.pnpm ladle:buildadded to the gate so broken stories fail the build;tsconfigincludes.ladleso the harness is type-checked too.Acceptance criteria
@ladle/reactadded;pnpm ladleserves andpnpm ladle:buildsucceeds..ladle/{config.mjs,vite.config.ts,components.tsx}exist; the decoratorrenders components with NextUI + i18n + React Query + Helmet + global styles.
level; kebab-case filenames;
@/*imports;build+typecheckclean.tailwind-variantsused for the variant-bearing component (
chip).*.stories.tsxexists for every atom and molecule and for non-maporganisms, using native Ladle controls, viewable in light + dark.
DESIGN_SYSTEM.mdandSTORYBOOK.mdcommitted;.claude/rules/components.mdreferences them.
ladle:buildgates the workflow.Notes for review
event-panel, soevent-panel/event-details/event-registrationare intentionally excludedfrom the organisms barrel (reached by direct import) — otherwise a barrel
import would pull them into the main chunk. Verified:
Appchunk1,476 → 1,214 kB,
event-panelback in its own ~263 kB lazy chunk.tailwind.config.jsshows a large diff: it wasn't Prettier-compliant(double quotes), and the repo's format hook normalized it on edit (no
.prettierignore). Purely quote/whitespace changes — no logic change.event-soon.tsxandevent-registration.tsxhave pre-existing Rules-of-Hooks ordering (hooks after an early
return null) —unchanged by this PR (files only moved), and the new stories don't trigger them.
Worth a future cleanup. Also, the app's HTTP-backed i18n singleton can still
initialize transitively in Ladle; stories nonetheless resolve text via the
isolated bundled-resource instance (its background fetch fails harmlessly).
Manual / visual verification
Run
pnpm ladleand browse the tree (Atoms / Molecules / Organisms), togglingthe light/dark theme. Map stories render a "needs token" notice unless
VITE_MAPBOX_ACCESSTOKENis set in.env.local.Closes #5
🤖 Generated with Claude Code