Skip to content

feat: add Storybook 10 with stories + a11y test runner#3

Merged
fiqrikm18 merged 2 commits into
masterfrom
feat/storybook
Jul 17, 2026
Merged

feat: add Storybook 10 with stories + a11y test runner#3
fiqrikm18 merged 2 commits into
masterfrom
feat/storybook

Conversation

@fiqrikm18

Copy link
Copy Markdown
Contributor

What

Adds Storybook 10 to the design system with stories for all 12 UI components and an automated accessibility test runner in CI.

Storybook setup

  • Framework: @storybook/angular-vite (Vite builder) with zoneless mode for Angular 22 — aligns with the app's zoneless + esbuild/vite setup.
  • Config: .storybook/main.ts + .storybook/preview.ts (loads the app's tailwind + styles + design tokens so stories render with real styles).
  • Builders registered in angular.json — run via ng run saas-business-app:storybook / :build-storybook (the Storybook 10 Angular builder approach).

Stories — 12 files / 59 stories

All UI design-system components, organized by atomic design:

Category Components Stories
Atoms button, input, badge, avatar, spinner 34
Molecules card, toast 10
Organisms data-table, dialog, form-field, empty-state, error-state 23

Each story file covers the component's input variants (sizes, colors, states, loading/disabled, error/empty/loading states, sortable columns, etc.) with autodocs.

Testing

  • @storybook/addon-a11y — in-UI accessibility checks for every story.
  • @storybook/test-runner — automated a11y scan of every story in CI (color-contrast, aria-valid-attr, aria-roles, button-name, image-alt, label rules). Config in .storybook/test-runner.ts.

CI

  • New storybook job: installs chromium, builds storybook, serves the static build, and runs the test-runner for automated a11y tests.
  • Bug fix: the workflow triggered on main but the repo default branch is master — CI never ran. Fixed to master.
  • .npmrc with legacy-peer-deps=true so npm ci works with the NgRx/Angular + Storybook peer conflicts.

Dependency notes

Storybook's Angular builder requires @angular-devkit/build-angular and zone.js, and Vite bundling requires @angular/animations (which @angular/material needs anyway). These are added as devDeps — the app's own build stays on @angular/build:application; only Storybook uses the devkit builder. Install requires --legacy-peer-deps (now automated via .npmrc).

Verification

Check Result
npm run lint 0 errors (4 pre-existing warnings)
npm run build succeeds
npm test -- --no-watch 16 files / 67 tests pass
npm run build-storybook succeeds (12 story files / 59 stories)

Scripts added

Script Purpose
npm run storybook dev server on :6006
npm run build-storybook static build to dist/storybook/
npm run test-storybook run test-runner against a built storybook

… runner

- storybook: scaffold @storybook/angular-vite (Vite builder) with zoneless
  mode for Angular 22; config in .storybook/main.ts + preview.ts
- stories: 12 story files / 59 stories covering all UI atoms (button, input,
  badge, avatar, spinner), molecules (card, toast), and organisms
  (data-table, dialog, form-field, empty-state, error-state)
- a11y: @storybook/addon-a11y for in-UI accessibility checks
- test-runner: @storybook/test-runner with a11y rules config; CI builds
  storybook, serves it, and runs the test-runner for automated a11y scans
- ci: add storybook job; fix branch trigger main->master (CI never ran);
  add .npmrc with legacy-peer-deps so npm ci works with the NgRx/Storybook
  peer conflicts
- deps: @angular/animations (required by @angular/material + Vite bundling),
  @angular-devkit/build-angular + zone.js (Storybook builder needs them;
  app build stays on @angular/build:application)
- chore: ignore storybook-static/ and debug-storybook.log
Avoids shadowing the global Error constructor (SonarQube S2814 /
no-shadow-restricted-names) in badge and toast story files.
@fiqrikm18
fiqrikm18 merged commit 4bdaccc into master Jul 17, 2026
5 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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