Repository navigation
Description
Summary
Following the original component-library standardization (#5 / #6) and the Dropdown
unification (#12), the design system (src/components/{atoms,molecules,organisms}/,
24 component folders / 25 Ladle stories) has drifted in three ways: barrels leak
internals via export *, sibling components disagree on prop names, and story titles
carry an ad-hoc second level. This ticket brings SahajAtlas in line with the cleaner
conventions used in the sibling WeMeditateWeb project — explicit named exports
(primary component + Props type only), single-level story titles, and disciplined
prop naming — plus inlining single-use internals and a light visual-consistency pass.
No runtime behavior change. SahajAtlas deliberately uses NextUI primitives
directly and only wraps when there's app-specific value, so we adopt WeMeditate's
export/story/naming conventions, not its component inventory. The widget is the only
consumer of these props, so the internal renames are safe.
Current behavior
- Leaky exports. Component and tier barrels use
export *, re-exporting
subcomponents, helpers (isSoon), and internals alongside the primary component. - Inconsistent props. Navigation (
linkvsreturnLink), overlay state
(open/closevsisOpen/onOpenChange), and domain booleans (isOnlinevs
online,convertTimeZone) diverge across sibling components. - Story sprawl. Story titles carry an ad-hoc second level (
Atoms / Feedback,
Molecules / Display, …) and a few pure-internal subcomponents have their own folders.
Proposed changes
1. Strict export surface
- Replace every
export *with explicitexport { X } from './X'+
export type { XProps }in all component barrels and the three tier barrels. - Extract
isSoon()(and the timezone-format helper) into a newsrc/lib/events.ts
— a home for pure domain utils, so non-UI consumers can use the predicate without
importing a component. UpdateEventsListandEventSoonChipto import from@/lib. - Documented multi-export exceptions (the only allowed ones, spelled out in
DESIGN_SYSTEM.md):Dropdowncompound —export { Dropdown, DropdownItem }+ Props.Icons/— an icon-set module.Mapbox/— sub-module exposingMapbox+MapSearch(layers/themes stay internal).EventsList/— container/presentational pair (DynamicEventsList+EventsList).
2. Inline single-use internals (and drop their previews)
- EventShare — keep
ShareButtonas the only export; makeShareModal+
ShareContentmodule-private (extract the shared social-link markup into a private
helper reused byRegistrationModal, or keep one exportedShareContentif cleaner —
document whichever). - EventRegistration — keep
RegistrationButtonexported; makeRegistrationModal+
RegistrationFieldsprivate. - EventDetails — inline the generic
EventDetailprimitive. Preferred: consolidate
the three cards into a singleEventDetailscomponent (<EventDetails event={event} />)
so the folder has one primary export + one story; ifEventPanel's layout interleaves
the cards, keep them as a documented family instead. - TimezoneChip — move out of
atoms/Chip/and inline as a private composition in
EventTime; theChipbarrel then exports onlyChip.
3. Atomic-design ruling — TimezoneChip / EventSoonChip
Neither become Chip variants (that would push tooltip/date logic into a primitive
atom), nor raw <Chip> rebuilt at every call site (duplicated color/icon/copy):
Chipstays a pure presentational atom — never any time/date/domain logic.- Domain logic → pure helpers in
src/lib/(EventsListsorting needs theisSoon
predicate, not a Chip). - Single-use composition → inline into its one parent (
TimezoneChip→EventTime). - Multi-use composition → a thin molecule (
EventSoonChip, used byEventItemand
EventPanel, stays a small wrapper overChip+isSoon()).
4. Flatten story titles
- Every
*.stories.tsx: settitleto the bare tier ('Atoms'/'Molecules'/
'Organisms'); component name stays inDefault.storyName. Removes all
/ Subcategorysecond levels.
5. Standardize props (rename + update all call sites)
| Component | Change |
|---|---|
ListItem |
link → href |
ListHeader, SearchBar |
returnLink → backHref |
Lightbox |
open → isOpen, close → onClose |
RegistrationModal (now private) |
isOnline → online (match the Event schema field) |
EventTimingDetails |
convertTimeZone → showTimeZone (match EventTime) |
EventTime |
document that delay only applies when showTimeZone is set |
Naming rule to document: state/behavior booleans use isX; props that pass through a
zod/schema field keep the field name (online); handlers use onX.
6. Minor visual-consistency pass
- Align the two modals (
ShareModal,RegistrationModal) on shared header/body/footer
spacing & typography. - Verify chips (
EventSoonChip, online/offline chips inEventItem/EventPanel) use a
consistentcolor/emphasistoken set. - Reconcile sticky-header spacing/sizing between
ListHeaderandSearchBar. - Keep changes cosmetic and small; capture before/after screenshots.
7. Documentation
DESIGN_SYSTEM.md— rewrite the export section (explicit named exports only; the
"what NOT to export" list; the named exception list; "atoms stay primitive / domain
logic →src/lib/"; the inline-single-use rule). Addsrc/lib/to the file layout.STORYBOOK.md— replace the subcategory map with the single-level title convention..claude/rules/components.md— update the structure/export bullets to match.
Acceptance criteria
- No
export *remains in component or tier barrels; each exports only its primary
component(s) +Propstype, except the four documented exceptions. -
isSoon()+ tz-format helper live insrc/lib/events.ts; no component barrel
re-exports a helper, constant, or variant map. -
ShareModal/ShareContent,RegistrationModal/RegistrationFields, the
EventDetailprimitive, andTimezoneChipare private to their parent and no
longer appear as separate Ladle sidebar entries. -
Chipcontains no time/date/domain logic;EventSoonChipremains a thin molecule. - Ladle sidebar shows exactly three top-level groups (Atoms / Molecules / Organisms)
with no second level. - Props renamed per the table above and all call sites updated
(src/pages/*,src/App.tsx, component cross-imports). -
DESIGN_SYSTEM.md,STORYBOOK.md, and.claude/rules/components.mdreflect the
new export + story + naming conventions. - No visual or behavioral regression (verified by Playwright spot-check of the event
panel, share/registration modals, list/search navigation, theme/locale switch). -
pnpm typecheck,pnpm lint,pnpm test:run,pnpm ladle:build, and
pnpm buildall pass.
Files affected
Pattern repeats across all 24 component folders; key touch points:
src/components/*/index.ts(all barrels) + the three tierindex.tssrc/components/atoms/Chip/Chip.tsx,atoms/Lightbox/Lightbox.tsxsrc/components/molecules/EventTime/EventTime.tsx,EventSoon/EventSoon.tsx,
EventShare/EventShare.tsx,List*/,SearchBar/src/components/organisms/EventRegistration/EventRegistration.tsx,
EventDetails/EventDetails.tsx,EventPanel/EventPanel.tsx,
EventsList/EventsList.tsx- New
src/lib/events.ts - Docs:
DESIGN_SYSTEM.md,STORYBOOK.md,.claude/rules/components.md
Out of scope (future work)
- Building WeMeditate-style atoms we lack (Badge, Tooltip wrapper, Breadcrumbs, …) —
deferred given the NextUI-direct philosophy. - Optional deeper splits (
Fallbacks/→LoadingFallback/+ErrorFallback/,
MapSearchinto its own folder) — follow-ups, not blockers.
References
- feat(components): add ladle previews + standardize component library #5 / feat(components): add ladle previews + standardize component library #6 — original "add ladle previews + standardize component library"
- refactor(ui): unify dropdowns on a shared floating-ui Dropdown #12 — "unify dropdowns on a shared floating-ui Dropdown" (origin of the
Dropdown+DropdownItemcompound export) DESIGN_SYSTEM.md,STORYBOOK.md,.claude/rules/components.md
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
docs: allow showX/hideX visibility booleans in the naming rule
chore(lint): clear all eslint warnings and gate CI at zero warnings
refactor(molecules): address review feedback on list/time/event compo…
fix(events): recurrence label, tooltip bg, list-item spacing