-
Notifications
You must be signed in to change notification settings - Fork 0
Add Storybook baseline for UI primitives #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ef49669
Add Storybook 10.3 devDependencies and npm scripts
Chris0Jeky 56a87af
Add Storybook configuration for Vue 3 + Vite
Chris0Jeky ef310be
Add storybook-static to .gitignore
Chris0Jeky 294b196
Add stories for TdButton and TdIconButton
Chris0Jeky ebf03c8
Add stories for form primitives (TdInput, TdTextarea, TdSelect, TdFie…
Chris0Jeky f276447
Add stories for overlay primitives (TdDialog, TdDropdown, TdPopover, …
Chris0Jeky 58f3ae1
Add stories for feedback primitives (TdToast, TdInlineAlert, TdSpinne…
Chris0Jeky 7130d44
Add stories for data display primitives (TdBadge, TdTag, TdEmptyState)
Chris0Jeky 7d8b397
Fix PWA plugin stripping to only remove PWA-related array plugins
Chris0Jeky 737563c
Merge remote-tracking branch 'origin/main' into feature/storybook-bas…
Chris0Jeky 23a545b
Refine Storybook baseline controls and docs
Chris0Jeky ab4bee6
Merge branch 'main' into feature/storybook-baseline
Chris0Jeky 1610d04
Fix Storybook review feedback
Chris0Jeky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
docs/decisions/ADR-0030-storybook-baseline-vite-8-compatibility.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # ADR-0030: Storybook Baseline with Vite 8 Compatibility | ||
|
|
||
| - **Status**: Accepted | ||
| - **Date**: 2026-04-09 | ||
| - **Deciders**: Taskdeck maintainers | ||
|
|
||
| ## Context | ||
|
|
||
| Taskdeck uses Vite 8 in the frontend workspace. The Storybook baseline issue requested Storybook 8.x, but Storybook 8 does not support the Vite 8 toolchain used by the app. | ||
|
|
||
| The team still needs a stable, reviewable component catalogue for the 17 `Td*` primitives, plus a place to validate visual variants without touching the production app. | ||
|
|
||
| ## Decision | ||
|
|
||
| Use Storybook 10.3.x for the frontend Storybook baseline. | ||
|
|
||
| Reasons: | ||
|
|
||
| - Storybook 10.3.x supports `vite@^8.0.0`. | ||
| - The CSF3 story format remains the same, so the story authoring model stays familiar. | ||
| - The preview should import the app stylesheet so Storybook reflects the production component look and spacing as closely as practical. | ||
| - Story files live in `src/stories/` to keep the component directory focused on runtime code. | ||
|
|
||
| ## Alternatives Considered | ||
|
|
||
| - Storybook 8.x: rejected because it is not compatible with Vite 8. | ||
| - Deferring Storybook entirely: rejected because the component library needs a reviewable baseline now. | ||
| - Co-locating stories with components: workable, but rejected for this baseline because a centralized story directory keeps the setup simpler. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Storybook can be built and maintained without downgrading Vite. | ||
| - Visual review of `Td*` primitives is available through `npm run storybook` and `npm run storybook:build`. | ||
| - Story files are excluded from the app typecheck, so production compilation stays focused on runtime code. | ||
| - Future contributors have a recorded rationale for the Storybook version choice. | ||
|
|
||
| ## References | ||
|
|
||
| - PR #807 | ||
| - Issue #251 | ||
| - `frontend/taskdeck-web/.storybook/main.ts` | ||
| - `frontend/taskdeck-web/.storybook/preview.ts` | ||
| - `frontend/taskdeck-web/src/stories/` |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ lerna-debug.log* | |
| node_modules | ||
| dist | ||
| dist-ssr | ||
| storybook-static | ||
| *.local | ||
|
|
||
| # Editor directories and files | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import type { StorybookConfig } from '@storybook/vue3-vite' | ||
|
|
||
| function isPwaPlugin(plugin: unknown): boolean { | ||
| if (plugin && typeof plugin === 'object' && 'name' in plugin) { | ||
| const name = String((plugin as { name?: unknown }).name ?? '').toLowerCase() | ||
| return name.includes('pwa') || name.includes('workbox') | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| function stripPwaPlugins(plugins: unknown[]): unknown[] { | ||
| const filtered: unknown[] = [] | ||
|
|
||
| for (const plugin of plugins) { | ||
| if (Array.isArray(plugin)) { | ||
| // Recursively filter nested arrays but preserve the array structure | ||
| const filteredNested = stripPwaPlugins(plugin) | ||
| if (filteredNested.length > 0) { | ||
| filtered.push(filteredNested) | ||
| } | ||
| continue | ||
| } | ||
| if (!isPwaPlugin(plugin)) { | ||
| filtered.push(plugin) | ||
| } | ||
| } | ||
|
|
||
| return filtered | ||
| } | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ['../src/**/*.stories.@(ts|tsx)'], | ||
| framework: { | ||
| name: '@storybook/vue3-vite', | ||
| options: { | ||
| docgen: 'vue-component-meta', | ||
| }, | ||
| }, | ||
| async viteFinal(viteConfig) { | ||
| // Strip PWA plugin — it is app-specific and breaks the Storybook build | ||
| // because the Storybook output includes large JS bundles that exceed | ||
| // the workbox precache size limit. | ||
| return { | ||
| ...viteConfig, | ||
| plugins: viteConfig.plugins | ||
| ? (stripPwaPlugins(viteConfig.plugins as unknown[]) as typeof viteConfig.plugins) | ||
| : viteConfig.plugins, | ||
| } | ||
| }, | ||
| } | ||
|
|
||
| export default config | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { Preview } from '@storybook/vue3-vite' | ||
| import '../src/style.css' | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { expanded: true }, | ||
| backgrounds: { | ||
| default: 'obsidian', | ||
| values: [ | ||
| { name: 'obsidian', value: '#131313' }, | ||
| { name: 'light', value: '#f5f3f1' }, | ||
| ], | ||
| }, | ||
| }, | ||
| decorators: [ | ||
| (story) => ({ | ||
| components: { story }, | ||
| template: ` | ||
| <div style="padding: 1rem;"> | ||
| <story /> | ||
| </div> | ||
| `, | ||
| }), | ||
| ], | ||
| } | ||
|
|
||
| export default preview |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
viteFinalconfiguration directly mutates theconfig.pluginsarray. It is safer to treat the configuration object as immutable and return a new object to avoid potential side effects in the Vite build pipeline.