Skip to content

feat: add Storybook stories for pure components#7100

Draft
talissoncosta wants to merge 3 commits intochore/design-system-tokensfrom
feat/storybook-component-stories
Draft

feat: add Storybook stories for pure components#7100
talissoncosta wants to merge 3 commits intochore/design-system-tokensfrom
feat/storybook-component-stories

Conversation

@talissoncosta
Copy link
Copy Markdown
Contributor

@talissoncosta talissoncosta commented Apr 2, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #6882

Add Storybook stories for 39 components organised into 8 sidebar categories. Fix components to remove unnecessary dependencies that blocked Storybook rendering.

Stories (39 components)

Category Components
Forms Button, ButtonDropdown, Checkbox, CheckboxGroup, GhostInput, Radio, Switch
Feedback Banner, EmptyState, InfoMessage, Loader, WarningMessage
Navigation Breadcrumb, NavSubLink, SidebarLink, Tabs
Layout AccordionCard, Card, FormGroup, PageTitle, Panel, Row
Data Display BooleanDotIndicator, ClearFilters, Confidence, DropdownMenu, IdentifierString, LabelWithTooltip, Logo, SettingTitle, StatItem, ToggleChip, Tooltip, VCSProviderTag
Modals Modal (Alert, Header, CloseButton), ModalDefault
Patterns SettingRow, Skeleton
Icons Icons catalogue

Component fixes

Component Change Risk
Checkbox Utils.GUID()Math.random() Low
StatItem Utils.numberWithCommas()toLocaleString(), IonIcon → Icon Low
Panel, PageTitle Add explicit Row import (was window global) None
LabelWithTooltip Add explicit Tooltip import (was window global) None
InfoMessage, AccordionCard, IdentifierString IonIcon → Icon (removes @ionic/react dep) Low
WarningMessage Remove dead enabledButton prop and Constants import None
Confidence Inline convertToPConfidence (4 lines, removes Utils) None
Tabs Inline fromParam using URLSearchParams (removes Utils) Low
ToggleChip Add Row import, inline Utils.colour() with Color lib Low
tagColors (6 files) Extract to common/constants/tag-colours.ts None
Loader Extract from project-components.js to Loader.tsx, currentColor instead of #6633ff None

Storybook infrastructure

  • Webpack mocks: code-help.js, _data.js, dompurify.js — stub CommonJS modules
  • Globals: Tooltip, Row, FormGroup registered in preview.js
  • Unit tests: convertToPConfidence (5 tests), fromParam (6 tests)

Coverage

How did you test this code?

  • npm run storybook — all stories render in light and dark mode
  • npm run test:unit -- --testPathPatterns="convertToPConfidence|fromParam" — 11 tests pass
  • npx eslint --fix passes on all modified files

Smoke test before merge

Components were changed to remove dependencies. Verify in the app:

  • Checkbox — toggle any checkbox (e.g. server-side only)
  • InfoMessage — verify info banner renders with chevron icon
  • AccordionCard — verify accordion expands/collapses
  • WarningMessage — trigger a warning message
  • StatItem — check usage page, verify numbers format correctly
  • Panel — verify panels with title + action render correctly
  • Tabs — navigate between tabs (e.g. feature modal)
  • IdentifierString — check identity page
  • ToggleChip — verify tag chips render with correct colours
  • Loader — verify loading spinner appears
  • PageTitle — verify page headers render
  • tagColors — create/edit a tag, verify colour picker works

Storybook verification

  • Run npm run storybook and click through all 8 categories
  • Toggle dark mode — verify all stories render in both themes

@talissoncosta talissoncosta requested a review from a team as a code owner April 2, 2026 03:47
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team April 2, 2026 03:47
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Apr 2, 2026 11:57am
flagsmith-frontend-staging Ready Ready Preview, Comment Apr 2, 2026 11:57am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 2, 2026 11:57am

Request Review

@talissoncosta talissoncosta marked this pull request as draft April 2, 2026 03:47
@talissoncosta talissoncosta marked this pull request as draft April 2, 2026 03:47
@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard feature New feature or request labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7100 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-7100 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7100 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7100 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7100 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7100 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  23.9 seconds
commit  20167e3
info  🔄 Run: #15628 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  29.4 seconds
commit  20167e3
info  🔄 Run: #15628 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  16 passed

Details

stats  16 tests across 13 suites
duration  34.7 seconds
commit  20167e3
info  🔄 Run: #15628 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  53.6 seconds
commit  20167e3
info  🔄 Run: #15628 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  46.7 seconds
commit  b347360
info  🔄 Run: #15652 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  28.4 seconds
commit  b347360
info  🔄 Run: #15652 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  52.1 seconds
commit  b347360
info  🔄 Run: #15652 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  53.5 seconds
commit  b347360
info  🔄 Run: #15652 (attempt 1)

talissoncosta and others added 3 commits April 2, 2026 08:53
Infrastructure to unblock components in Storybook:
- Webpack aliases: stub common/code-help and common/data/base/_data.js
  (CommonJS files that break ESM bundler), mock dompurify
- Register globals in preview.js: Tooltip, Row, FormGroup
- Extract tagColors to common/constants/tag-colours.ts (breaks
  Constants → store chain for ColourSelect consumers)
- Add unit tests for convertToPConfidence and fromParam (11 tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix components to remove unnecessary dependencies that blocked
Storybook rendering:

- Checkbox: Utils.GUID() → Math.random()
- StatItem: Utils.numberWithCommas() → toLocaleString(), IonIcon → Icon
- Panel, PageTitle: add explicit Row import (was window global)
- LabelWithTooltip: add explicit Tooltip import (was window global)
- InfoMessage, AccordionCard, IdentifierString: IonIcon → Icon
- WarningMessage: remove dead enabledButton prop and Constants import
- Confidence: inline convertToPConfidence (remove Utils import)
- Tabs: inline fromParam using URLSearchParams (remove Utils import)
- ToggleChip: add Row import, inline Utils.colour() with Color lib
- ColourSelect consumers (6 files): use extracted tagColors
- Extract Loader from project-components.js to standalone Loader.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Stories organised into sidebar categories:
- Forms: Button, ButtonDropdown, Checkbox, CheckboxGroup, GhostInput,
         Radio, Switch
- Feedback: Banner, EmptyState, InfoMessage, Loader, WarningMessage
- Navigation: Breadcrumb, NavSubLink, SidebarLink, Tabs
- Layout: AccordionCard, Card, FormGroup, PageTitle, Panel, Row
- Data Display: BooleanDotIndicator, ClearFilters, Confidence,
                DropdownMenu, IdentifierString, LabelWithTooltip,
                Logo, SettingTitle, StatItem, ToggleChip, Tooltip,
                VCSProviderTag
- Modals: Modal (Alert, Header, CloseButton), ModalDefault
- Patterns: SettingRow, Skeleton
- Icons: Icons catalogue

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@talissoncosta talissoncosta force-pushed the feat/storybook-component-stories branch from b5c3ac9 to b347360 Compare April 2, 2026 11:54
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Apr 2, 2026
@talissoncosta talissoncosta marked this pull request as ready for review April 2, 2026 12:24
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Apr 2, 2026
@talissoncosta talissoncosta linked an issue Apr 2, 2026 that may be closed by this pull request
@talissoncosta talissoncosta marked this pull request as draft April 2, 2026 14:14
@talissoncosta talissoncosta marked this pull request as draft April 2, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spike: Storybook component coverage — findings and blockers

1 participant