Skip to content

Configure Storybook and Document Design System Primitives (#361)#433

Open
JoyLight00 wants to merge 3 commits into
LightForgeHub:mainfrom
JoyLight00:feat/storybook-primitives-config
Open

Configure Storybook and Document Design System Primitives (#361)#433
JoyLight00 wants to merge 3 commits into
LightForgeHub:mainfrom
JoyLight00:feat/storybook-primitives-config

Conversation

@JoyLight00

@JoyLight00 JoyLight00 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Closes : #361
This pull request configures Storybook for the design system primitives and adds corresponding stories for Button, Card, Avatar, Badge, and StatusBadge. It also fixes existing typescript/linter warnings and a minor markup syntax error to ensure error-free compilation of both Next.js and Storybook.

To avoid the Webpack/Turbopack compatibility conflicts common in Next.js 15, Storybook was configured to use the Vite builder (@storybook/react-vite), which runs in a isolated, super-fast pipeline while sharing path aliases and Tailwind CSS v4 variables seamlessly.

Key Changes
Storybook Integration & Config:

Added Storybook 8.6.18 packages and vite as devDependencies.
Initialized .storybook/ configurations:
main.ts: Configures the @storybook/react-vite framework.
preview.ts: Imports the main src/app/globals.css style definitions so Tailwind classes load inside the stories.
tsconfig.json: Extends root typescript configurations.
Modified postcss.config.mjs to dynamically detect running environments (Storybook/Vite vs. Next.js) and serve plugins in their corresponding compatible format (tailwindcss() vs ["@tailwindcss/postcss"]).
Added /storybook-static to .gitignore.
Primitive UI Stories:

Button.stories.tsx: Documents all 8 style variants (primary, glow, destructive, outline, etc.), sizes, and interactive states.
Card.stories.tsx: Showcases nested components (CardHeader, CardContent, etc.) and visual configurations.
Avatar.stories.tsx: Demonstrates image loading and initials fallback state.
Badge.stories.tsx: Details the look and feel of all 9 badge colors/variants.
StatusBadge.stories.tsx: Details mapped state tags (resolved, pending, completed, draft, published) and custom fallbacks.
Linter & Syntax Bug Fixes:

Removed CLI-generated boilerplate stories in src/stories that were causing unescaped JSX quotation errors.
Fixed a syntax error in SessionHistory.tsx where an unclosed header div was breaking type compilation.
Removed unused imports and variable declarations (sessionId in RefundForm.tsx, error in useHeartbeat.ts, useEffect in NotificationHub.tsx, and ratesLoading in ExpertCard.tsx).

Summary by CodeRabbit

  • New Features

    • Added Storybook support with a full configuration, scripts, and component stories for several UI elements.
    • New stories showcase common component states and variants for easier visual review.
  • Bug Fixes

    • Improved a notifications link to use app navigation for smoother routing.
    • Refined a few UI details, including dashboard text styling and rate display handling.
  • Chores

    • Expanded ignore rules for build outputs, logs, environment files, and Storybook artifacts.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@JoyLight00, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41edfd5b-fed1-4f0d-8980-a56c7bb9f068

📥 Commits

Reviewing files that changed from the base of the PR and between 281b406 and b7f1039.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • contracts/src/disputes.rs
  • contracts/src/errors.rs
  • contracts/src/events.rs
  • contracts/src/governance.rs
  • contracts/src/lib.rs
  • contracts/src/migrations.rs
  • contracts/src/oracles.rs
  • contracts/src/recovery.rs
  • contracts/src/reputation.rs
  • contracts/src/storage.rs
  • contracts/src/timelock.rs
  • contracts/src/treasury.rs
📝 Walkthrough

Walkthrough

This PR introduces Storybook configuration and tooling (config files, package.json scripts/dependencies, conditional PostCSS setup, .gitignore updates) plus story files for Avatar, Badge, Button, Card, and StatusBadge components. It also includes unrelated minor cleanups to SessionHistory, NotificationHub, ExpertCard, ExpertDetails, RefundForm, and useHeartbeat.

Changes

Storybook Setup and Stories

Layer / File(s) Summary
Storybook configuration and tooling
.storybook/main.ts, .storybook/preview.ts, .storybook/tsconfig.json, package.json, postcss.config.mjs, .gitignore
Adds Storybook main/preview/tsconfig configs, dev scripts and dependencies, conditional Tailwind/PostCSS plugin selection for Storybook builds, and ignore rules for Storybook artifacts.
Avatar and Badge stories
src/components/ui/Avatar.stories.tsx, src/components/ui/Badge.stories.tsx
Adds Storybook metadata and story exports demonstrating default/fallback Avatar states and all Badge variants.
Button, Card, and StatusBadge stories
src/components/ui/Button.stories.tsx, src/components/ui/Card.stories.tsx, src/components/ui/StatusBadge.stories.tsx
Adds Storybook metadata and story exports covering Button variants/sizes/icons, Card variants, and StatusBadge status values including edge cases.

Component and Hook Cleanups

Layer / File(s) Summary
UI markup and navigation fixes
src/components/dashboard/SessionHistory.tsx, src/components/layout/NotificationHub.tsx
Updates subtitle text styling and header markup in SessionHistory, and replaces a plain anchor with Next.js Link in NotificationHub.
Rate calculation and form prop cleanup
src/components/marketplace/ExpertCard.tsx, src/components/profile/ExpertDetails.tsx, src/components/session/RefundForm.tsx, src/hooks/useHeartbeat.ts
Simplifies useCurrency destructuring, removes unused minuteRateUSD calculation, removes unused sessionId prop and a BOM artifact from RefundForm, and drops an unused error binding in a catch clause.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: Storybook setup plus new design system stories.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
src/components/session/RefundForm.tsx (1)

135-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

sessionId still required in RefundFormProps but no longer used.

The interface (line 48) still declares sessionId: string; as a required prop, yet the component no longer destructures or uses it. Callers are still forced to pass it, but the value is now silently dropped. Given the TODO at line 202 references settle_session(sessionId, ...) for the future on-chain wiring, consider either removing sessionId from RefundFormProps now (if genuinely unused) or keeping it destructured (even if unused) to avoid re-plumbing it later when the real contract call is added.

♻️ Suggested fix: remove unused prop from interface
 interface RefundFormProps {
   ...
-  sessionId: string;
   ...
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/session/RefundForm.tsx` around lines 135 - 141,
`RefundFormProps` still requires `sessionId`, but `RefundForm` no longer
destructures or uses it. Update the `RefundFormProps` interface and the
`RefundForm` component together: either remove `sessionId` from the required
props now if it is truly unused, or keep it destructured in `RefundForm` if you
want to preserve the future `settle_session(sessionId, ...)` wiring referenced
in the TODO. Make sure the component signature and all callers stay consistent
with the chosen approach.
.storybook/main.ts (1)

8-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider removing addon-onboarding from checked-in config.

@storybook/addon-onboarding is meant for the first-run guided tour and is typically removed once onboarding is complete, since it registers an "add a story" walkthrough that doesn't belong in a shared config.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.storybook/main.ts around lines 8 - 13, Remove `@storybook/addon-onboarding`
from the shared addons list in the Storybook config, since it is only meant for
the first-run guided tour. Update the addons array in the main Storybook
configuration to keep only the permanent addons such as addon-links,
addon-essentials, and addon-interactions.
postcss.config.mjs (1)

3-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fragile Storybook-environment detection via argv substring matching.

arg.includes("sb") is overly broad and can match unrelated CLI arguments/paths that happen to contain "sb", causing the wrong PostCSS plugin config to be selected outside genuine Storybook runs. Consider setting STORYBOOK=true explicitly in the storybook/build-storybook npm scripts (Line 10-11 of package.json) and relying on that single, unambiguous signal instead of the argv heuristic.

♻️ Proposed simplification
-const isStorybook = process.env.STORYBOOK === "true" || 
-  (process.env.npm_lifecycle_event && process.env.npm_lifecycle_event.includes("storybook")) ||
-  (process.argv && process.argv.some(arg => arg.includes("storybook") || arg.includes("sb")));
+const isStorybook = process.env.STORYBOOK === "true" ||
+  (process.env.npm_lifecycle_event?.includes("storybook") ?? false);
   "scripts": {
-    "storybook": "storybook dev -p 6006",
-    "build-storybook": "storybook build"
+    "storybook": "STORYBOOK=true storybook dev -p 6006",
+    "build-storybook": "STORYBOOK=true storybook build"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@postcss.config.mjs` around lines 3 - 5, The Storybook detection in
`postcss.config.mjs` is too broad because `isStorybook` relies on `process.argv`
substring checks, especially `arg.includes("sb")`, which can misidentify
non-Storybook runs. Simplify `isStorybook` to use a single explicit signal like
`process.env.STORYBOOK === "true"` and set that env var in the `storybook` and
`build-storybook` scripts in package.json; remove the `process.argv` heuristic
from the `isStorybook` expression.
.gitignore (1)

38-75: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate .gitignore entries.

This new block re-adds node_modules, .pnp, /coverage, /.next/, /build, npm-debug.log*, .env*, etc. — all already present earlier in the file (Lines 4-5, 14, 17, 21, 30, 36). Functionally harmless but adds redundant/confusing content under an unrelated "# vercel" header.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore around lines 38 - 75, Remove the duplicated ignore patterns added
under the "# vercel" section in .gitignore, since entries like node_modules,
.pnp, /coverage, /.next/, /build, npm-debug.log*, and .env* are already defined
earlier. Keep only the unique Vercel-related ignore rules, and use the existing
.gitignore sections and symbols (for example the "# dependencies", "# testing",
"# next.js", "# production", and "# debug" blocks) to avoid redundant, confusing
duplication.
package.json (1)

45-45: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unused @storybook/nextjs dependency.

.storybook/main.ts configures framework: { name: "@storybook/react-vite" } — the PR explicitly moved to the Vite builder to sidestep Next.js 15 Webpack/Turbopack issues. @storybook/nextjs (Line 45) doesn't appear to be referenced anywhere and adds unnecessary weight/confusion given the stated intent.

Also applies to: 47-47

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 45, The project is still listing unused Storybook
Next.js packages even though .storybook/main.ts uses the `@storybook/react-vite`
framework. Remove the unused `@storybook/nextjs` dependency from package.json and
also clean up the related extra entry mentioned in the review so the dependency
list matches the Vite-based Storybook setup. Verify there are no remaining
references to `@storybook/nextjs` in the Storybook config or scripts after the
cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.storybook/main.ts:
- Around line 1-22: Storybook is missing the repo’s `@/*` path alias, so imports
in stories can fail to resolve under Vite. Update the `config` in
`.storybook/main.ts` by adding a `viteFinal` hook (or equivalent `resolve.alias`
setup) that maps `@` to the project’s source directory, so `@/...` imports work
in Storybook 8 with Vite 6.

In `@src/components/ui/Card.stories.tsx`:
- Line 55: The gradient utility in the Card story uses the old Tailwind class,
so update the JSX in Card.stories.tsx to replace bg-gradient-to-br with the
Tailwind v4 equivalent bg-linear-to-br. Keep the rest of the className on the
story wrapper div unchanged so the visual styling remains the same.

---

Nitpick comments:
In @.gitignore:
- Around line 38-75: Remove the duplicated ignore patterns added under the "#
vercel" section in .gitignore, since entries like node_modules, .pnp, /coverage,
/.next/, /build, npm-debug.log*, and .env* are already defined earlier. Keep
only the unique Vercel-related ignore rules, and use the existing .gitignore
sections and symbols (for example the "# dependencies", "# testing", "#
next.js", "# production", and "# debug" blocks) to avoid redundant, confusing
duplication.

In @.storybook/main.ts:
- Around line 8-13: Remove `@storybook/addon-onboarding` from the shared addons
list in the Storybook config, since it is only meant for the first-run guided
tour. Update the addons array in the main Storybook configuration to keep only
the permanent addons such as addon-links, addon-essentials, and
addon-interactions.

In `@package.json`:
- Line 45: The project is still listing unused Storybook Next.js packages even
though .storybook/main.ts uses the `@storybook/react-vite` framework. Remove the
unused `@storybook/nextjs` dependency from package.json and also clean up the
related extra entry mentioned in the review so the dependency list matches the
Vite-based Storybook setup. Verify there are no remaining references to
`@storybook/nextjs` in the Storybook config or scripts after the cleanup.

In `@postcss.config.mjs`:
- Around line 3-5: The Storybook detection in `postcss.config.mjs` is too broad
because `isStorybook` relies on `process.argv` substring checks, especially
`arg.includes("sb")`, which can misidentify non-Storybook runs. Simplify
`isStorybook` to use a single explicit signal like `process.env.STORYBOOK ===
"true"` and set that env var in the `storybook` and `build-storybook` scripts in
package.json; remove the `process.argv` heuristic from the `isStorybook`
expression.

In `@src/components/session/RefundForm.tsx`:
- Around line 135-141: `RefundFormProps` still requires `sessionId`, but
`RefundForm` no longer destructures or uses it. Update the `RefundFormProps`
interface and the `RefundForm` component together: either remove `sessionId`
from the required props now if it is truly unused, or keep it destructured in
`RefundForm` if you want to preserve the future `settle_session(sessionId, ...)`
wiring referenced in the TODO. Make sure the component signature and all callers
stay consistent with the chosen approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 79ced26d-e9e2-41f3-96ba-9a06afca9e83

📥 Commits

Reviewing files that changed from the base of the PR and between 2dbcac7 and 281b406.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .gitignore
  • .storybook/main.ts
  • .storybook/preview.ts
  • .storybook/tsconfig.json
  • package.json
  • postcss.config.mjs
  • src/components/dashboard/SessionHistory.tsx
  • src/components/layout/NotificationHub.tsx
  • src/components/marketplace/ExpertCard.tsx
  • src/components/profile/ExpertDetails.tsx
  • src/components/session/RefundForm.tsx
  • src/components/ui/Avatar.stories.tsx
  • src/components/ui/Badge.stories.tsx
  • src/components/ui/Button.stories.tsx
  • src/components/ui/Card.stories.tsx
  • src/components/ui/StatusBadge.stories.tsx
  • src/hooks/useHeartbeat.ts
💤 Files with no reviewable changes (1)
  • src/components/profile/ExpertDetails.tsx

Comment thread .storybook/main.ts
Comment on lines +1 to +22
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: [
"../src/**/*.mdx",
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config; No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether the app relies on a "`@/`*" alias, and whether it's wired into vite/storybook config anywhere.
rg -n '"`@/`\*"' tsconfig.json
rg -n 'alias' .storybook/main.ts vite.config.* 2>/dev/null

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 196


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## Files\n'
git ls-files .storybook/main.ts tsconfig.json vite.config.* .storybook/* 2>/dev/null || true

printf '\n## Storybook config\n'
if [ -f .storybook/main.ts ]; then
  cat -n .storybook/main.ts
fi

printf '\n## TS config alias\n'
if [ -f tsconfig.json ]; then
  sed -n '1,120p' tsconfig.json | cat -n
fi

printf '\n## Vite config search\n'
rg -n --hidden --glob '!*node_modules*' --glob '!dist' --glob '!build' 'resolve\s*:|alias\s*:|`@/`\*|viteFinal|storybook' .storybook vite.config.* tsconfig*.json package.json 2>/dev/null || true

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 2942


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## Storybook tsconfig\n'
if [ -f .storybook/tsconfig.json ]; then
  cat -n .storybook/tsconfig.json
fi

printf '\n## Any "`@/`\" imports in repo\n'
rg -n --hidden --glob '!*node_modules*' --glob '!dist' --glob '!build' --glob '!coverage' 'from\s+["@'\'"'"'"]`@/`|import\s+["@'\'"'"'"]`@/`' . 2>/dev/null || true

printf '\n## Any Storybook Vite alias wiring\n'
rg -n --hidden --glob '!*node_modules*' --glob '!dist' --glob '!build' 'viteFinal|resolve\s*:\s*\{|alias\s*:' .storybook . 2>/dev/null || true

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 24191


🌐 Web query:

Storybook 8 react-vite tsconfig paths viteFinal alias automatic support documentation

💡 Result:

In Storybook 8 with the Vite builder, the approach for handling TypeScript path aliases (defined in tsconfig.json) depends on your version of Vite [1][2]. For projects using Vite 8 or higher, Storybook supports native resolution of TypeScript paths [1][2]. You do not need to use external plugins like vite-tsconfig-paths [1]. Instead, you should enable native support in your Vite configuration file (vite.config.ts) [1]: // vite.config.ts export default defineConfig({ resolve: { tsconfigPaths: true, }, }); If you are using an older version of Vite or need to manually configure aliases in Storybook regardless of your global Vite setup, you can use the viteFinal function in your.storybook/main.ts file [3][4]. This allows you to merge custom Vite configurations into the Storybook build process [5][4]. To manually configure paths using vite-tsconfig-paths (for older Vite versions): //.storybook/main.ts import { mergeConfig } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; export default { //... other config async viteFinal(config) { return mergeConfig(config, { plugins: [tsconfigPaths], }); }, }; Alternatively, to manually define specific aliases without a plugin: //.storybook/main.ts import { mergeConfig } from 'vite'; import path from 'path'; export default { //... other config async viteFinal(config) { return mergeConfig(config, { resolve: { alias: { '@': path.resolve(dirname, '../src'), }, }, }); }, }; Important Considerations: 1. Vite Configuration File: By default, Storybook's Vite builder attempts to read your project's vite.config.ts file [6][4]. However, it may sometimes override or ignore parts of it to ensure compatibility with Storybook’s internal build requirements [7][3]. 2. viteFinal: This function is the recommended way to override or extend the Vite configuration specifically for Storybook [8][4]. It receives the existing config and must return the modified version [5][4]. 3. Native Support: Always check if your project is running Vite 8+, as the native resolve.tsconfigPaths: true option is the preferred, modern approach [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## package.json Vite/Storybook deps\n'
if [ -f package.json ]; then
  rg -n '"vite"|`@storybook/`(react-vite|builder-vite|nextjs|react)' package.json
fi

printf '\n## vite config files\n'
git ls-files 'vite.config.*' '.storybook/*' 2>/dev/null || true

printf '\n## explicit Storybook Vite hooks or alias wiring\n'
rg -n --hidden --glob '!*node_modules*' --glob '!dist' --glob '!build' 'viteFinal|resolve\s*:\s*\{|alias\s*:|tsconfigPaths|tsconfigPaths' .storybook vite.config.* package.json tsconfig*.json 2>/dev/null || true

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 487


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## Story files\n'
git ls-files '*.stories.*' '*.mdx' '.storybook/*' 2>/dev/null || true

printf '\n## Alias imports inside story files\n'
rg -n --hidden --glob '*.stories.*' --glob '*.mdx' 'from\s+["'\'']`@/`|import\s+["'\'']`@/`' . 2>/dev/null || true

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 474


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## Button story\n'
cat -n src/components/ui/Button.stories.tsx

printf '\n## Button component imports\n'
sed -n '1,120p' src/components/ui/Button.tsx | cat -n

printf '\n## Card story\n'
cat -n src/components/ui/Card.stories.tsx

printf '\n## Card component imports\n'
sed -n '1,120p' src/components/ui/Card.tsx | cat -n

Repository: LightForgeHub/SkillSphere-Dapp

Length of output: 12057


🌐 Web query:

Storybook 8 builder-vite tsconfig paths automatically resolved vite 6 viteFinal alias docs

💡 Result:

Storybook 8 does not automatically resolve tsconfig paths for the Vite builder [1][2]. While Storybook's Vite builder attempts to merge your root vite.config.ts into its own configuration, it does not inherently apply tsconfig.json path mappings [3][4][2]. To resolve these aliases, you must explicitly configure them in your .storybook/main.ts file using the viteFinal hook [3][1][4]. The most common and effective way to achieve this is by using the vite-tsconfig-paths plugin within viteFinal [1][2][5]. Implementation Example: In your .storybook/main.ts (or .js), you can modify the Vite configuration as follows: import type { StorybookConfig } from '@storybook/your-framework'; import { mergeConfig } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; const config: StorybookConfig = { //... rest of your config async viteFinal(config) { return mergeConfig(config, { plugins: [tsconfigPaths], }); }, }; export default config; Alternatively, you can define aliases manually within viteFinal if you prefer not to use a plugin: async viteFinal(config) { config.resolve = config.resolve || {}; config.resolve.alias = {...(config.resolve.alias || {}), '@/src': path.resolve(dirname, '../src'), }; return config; }, Important Notes: 1. Vite Configuration: While Storybook looks for a vite.config.ts in your project root, it may not pick up all settings (like path plugins) automatically due to the specific way Storybook needs to wrap and manage the configuration [4][2]. 2. Custom Config Paths: If your Storybook configuration folder is not at the project root, you may need to explicitly specify the viteConfigPath in your main.ts to ensure your base Vite configuration is loaded correctly [3][1][4]. 3. Vite 6 Compatibility: The approach of using viteFinal to inject plugins or aliases remains the standard method for Vite 6 compatibility in Storybook 8 [3][6]. Ensure your dependencies, including vite-tsconfig-paths, are updated to versions compatible with Vite 6.

Citations:


Add Storybook Vite alias wiring

.storybook/main.ts doesn’t inherit the repo’s @/* path mapping, and Storybook 8 with Vite 6 won’t resolve tsconfig.json paths on its own. Add a viteFinal hook (or equivalent resolve.alias) here so stories can import @/... modules without build failures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.storybook/main.ts around lines 1 - 22, Storybook is missing the repo’s
`@/*` path alias, so imports in stories can fail to resolve under Vite. Update
the `config` in `.storybook/main.ts` by adding a `viteFinal` hook (or equivalent
`resolve.alias` setup) that maps `@` to the project’s source directory, so
`@/...` imports work in Storybook 8 with Vite 6.


export const Glass: Story = {
render: (args) => (
<div className="p-8 bg-gradient-to-br from-indigo-950 via-purple-950 to-slate-950 rounded-xl">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does Tailwind CSS v4.1 still support the legacy bg-gradient-to-* class names, or are they fully removed?

💡 Result:

In Tailwind CSS v4, the legacy bg-gradient-to-* class names have been removed and are no longer supported [1][2]. They have been replaced by the bg-linear-to-* utility set to better align with the underlying CSS linear-gradient function [1][3]. While the from-, via-, and to-* color stop utilities remain unchanged and fully compatible with the new gradient system [4][1][2], you must update your base utility classes from bg-gradient-to-* to bg-linear-to-* (e.g., changing bg-gradient-to-r to bg-linear-to-r) [1][2][3]. The official Tailwind CSS upgrade tool is designed to automatically detect and rewrite these legacy class names in your static code [1][3]. However, because this tool may not catch classes built dynamically (such as those concatenated in strings or templates), it is recommended to search your codebase for bg-gradient- after upgrading to ensure no legacy classes remain [1][2].

Citations:


Switch this gradient class to Tailwind v4 syntax

bg-gradient-to-br was removed in Tailwind v4, so this story won't render the intended gradient. Use bg-linear-to-br instead.

Proposed fix
-    <div className="p-8 bg-gradient-to-br from-indigo-950 via-purple-950 to-slate-950 rounded-xl">
+    <div className="p-8 bg-linear-to-br from-indigo-950 via-purple-950 to-slate-950 rounded-xl">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="p-8 bg-gradient-to-br from-indigo-950 via-purple-950 to-slate-950 rounded-xl">
<div className="p-8 bg-linear-to-br from-indigo-950 via-purple-950 to-slate-950 rounded-xl">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ui/Card.stories.tsx` at line 55, The gradient utility in the
Card story uses the old Tailwind class, so update the JSX in Card.stories.tsx to
replace bg-gradient-to-br with the Tailwind v4 equivalent bg-linear-to-br. Keep
the rest of the className on the story wrapper div unchanged so the visual
styling remains the same.

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.

Storybook Configuration for Design System Primitives

1 participant