Skip to content

Implement cohesive Storybook per UI portal application package #266

Description

@nnoce14

Summary

Add Storybook support to each portal app package so each portal can publish a cohesive, portal-specific visual review surface through Chromatic.

Storybook configuration should live in the existing portal app packages. Stories should remain colocated with the page/component source code in the upstream UI packages so developers and agents update visual coverage as part of normal feature work.

Scope

Add full Storybook support for:

  • @apps/ui-community
  • @apps/ui-staff

Do not create separate Storybook app packages.

Do not include @cellix/ui-core stories. Cellix framework UI has its own Storybook.

Requirements

Portal Storybook configuration

Each portal app package should have its own Storybook configuration:

apps/ui-community/.storybook/main.ts
apps/ui-community/.storybook/preview.tsx

apps/ui-staff/.storybook/main.ts
apps/ui-staff/.storybook/preview.tsx

Story discovery

Community Storybook should include stories from:

@apps/ui-community
@ocom/ui-shared
@ocom/ui-community-*

Staff Storybook should include stories from:

@apps/ui-staff
@ocom/ui-shared
@ocom/ui-staff-*

Use the existing story files where available and ensure they are wired into the correct portal Storybook.

Story organization

Each portal Storybook must organize stories into exactly two top-level sections:

Pages
Components

Page stories should use titles like:

Pages/Community/Listings/Listing Details
Pages/Staff/Admin/User Management

Component stories should use titles like:

Components/Shared/Empty State
Components/Community/Listing Card
Components/Staff/User Search Form

Story ownership

Stories should remain colocated with the source code they describe.

Example:

packages/ocom/ui-community-listings/src/pages/ListingsPage.tsx
packages/ocom/ui-community-listings/src/pages/ListingsPage.stories.tsx

packages/ocom/ui-shared/src/components/EmptyState.tsx
packages/ocom/ui-shared/src/components/EmptyState.stories.tsx

Rule:

The package that owns a page/component owns its stories.
The portal app owns Storybook configuration, decorators, and Chromatic publishing.

Portal decorators and mocks

Each portal Storybook should provide the required portal-level setup in preview.tsx, such as:

  • routing context
  • theme/providers
  • auth/session mocks
  • API mocks/MSW, if needed
  • portal layout wrappers, if needed

Stories should use mock data only and should not depend on live backend services.

Once this is implemented in both packages, a future effort will look to abstract commonalities for storybook configuration into a shared @cellix/config-storybook package.

Package scripts

Each portal app should expose scripts for:

  • running Storybook locally
  • building Storybook statically
  • publishing to Chromatic

Leverage portless to ensure distinct local ports so any number of portal Storybooks may run at the same time.

Acceptance Criteria

  • @apps/ui-community has a full working Storybook in the app package.
  • @apps/ui-staff has a full working Storybook in the app package.
  • Community Storybook includes stories from @apps/ui-community, @ocom/ui-shared, and @ocom/ui-community-*.
  • Staff Storybook includes stories from @apps/ui-staff, @ocom/ui-shared, and @ocom/ui-staff-*.
  • Existing story files are reused and correctly wired into the appropriate portal Storybook.
  • Each portal Storybook has exactly two top-level sections: Pages and Components.
  • Page stories appear under Pages.
  • Component stories appear under Components.
  • @cellix/ui-core stories are not included in either portal Storybook.
  • Story files remain colocated with their owning page/component source files.
  • Story files are excluded from production builds and normal runtime exports.
  • Each portal Storybook can run locally.
  • Each portal Storybook can build statically.
  • Each portal Storybook can be published independently through Chromatic.

Metadata

Metadata

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

Status
In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions