Skip to content

Replace design-system with Storybook app#306

Merged
aidenybai merged 1 commit intomainfrom
storybook-migration
Apr 20, 2026
Merged

Replace design-system with Storybook app#306
aidenybai merged 1 commit intomainfrom
storybook-migration

Conversation

@aidenybai
Copy link
Copy Markdown
Owner

@aidenybai aidenybai commented Apr 19, 2026

Summary

  • Migrates the component gallery from the custom @react-grab/design-system package + apps/website/app/design-system/ Next.js route into a standalone Storybook 10 app at apps/storybook/
  • Gallery now ships outside the website build, runs at http://localhost:6006, and isolates each overlay component with its real states
  • Scopes oxlint's no-unassigned-vars: off to *.tsx in the root vp config so Solid's idiomatic ref={varName} shorthand stops producing 9 false-positive warnings
  • Drops redundant lint / format / check scripts from react-grab and @react-grab/storybook — all consolidated at root via vp check

What's in the gallery

  • Playground — full sample dashboard scene with arg controls (selectedElement, prompt mode, context menu, comment presets). Element metadata derives from data-story-id / data-component attributes on the JSX nodes, so adding a new sample element is a one-line JSX change.
  • Components/SelectionLabel (16 states) — idle variants, long-name truncation, prompt / multiline / pending-dismiss, copying / copied, error + long error
  • Components/ContextMenu (5) — basic, with Open, tag-only, long component / tag
  • Components/Toolbar (7) — default, active, disabled, both, context-menu-open, with 3 / 42 comments
  • Components/CommentsDropdown (7) — empty, single, multiple, annotated, long-names, many, tag-only

Each component meta ships a play smoke test that asserts its root selector mounts.

Notable changes

  • apps/storybook/.storybook/main.ts disables storybook-solidjs-vite docgen (removes ~30 noisy dev-server warnings — docgen is React-only and useless here)
  • packages/react-grab/src/utils/find-unique-selector.ts + packages/cli/src/commands/configure.ts: fix two pre-existing no-useless-escape regex warnings ([a-z\-][a-z-])
  • vite.config.ts: lint.rules.overrides adds no-unassigned-vars: off scoped to **/*.tsx. Rule still catches real never-assigned bugs in .ts files; only disabled where Solid's JSX ref compiler transform is in play.
  • Root pnpm typecheck wired into turbo run typecheck so both react-grab and @react-grab/storybook typecheck in CI.
  • Removed apps/website/app/design-system/ route + packages/design-system/ package entirely — gallery no longer lives in the website.

Test plan

  • pnpm check — 380 files formatted, 324 lint-clean
  • pnpm typecheck — all 4 turbo tasks pass
  • pnpm --filter @react-grab/storybook build — static build succeeds
  • pnpm --filter @react-grab/storybook dev — all 40 stories render at :6006, play functions pass in the Interactions panel
  • pnpm build — core packages still build (storybook not in default filter, by design)
  • Visually walk each component's states in the Storybook sidebar

Note

Medium Risk
Medium risk because it removes the @react-grab/design-system package and the website’s /design-system route, and changes build/typecheck wiring, which could break internal developer workflows if any hidden dependencies remain.

Overview
Moves the UI state gallery out of the website and into a new standalone apps/storybook Storybook 10 workspace (SolidJS+Vite), including stories for SelectionLabel, ContextMenu, Toolbar, CommentsDropdown, plus a full ReactGrabRenderer playground.

Deletes the packages/design-system package and removes the Next.js apps/website/app/design-system route and related website build dependency, while updating Changesets ignore list and docs to reflect the new app.

Tweaks repo tooling: runs root typecheck via turbo run typecheck, adds a lint override disabling no-unassigned-vars for *.tsx, and fixes two minor regex warnings in the CLI config parser and find-unique-selector utility.

Reviewed by Cursor Bugbot for commit 09440ae. Bugbot is set up for automated code reviews on this repo. Configure here.

Migrate the component gallery from the bespoke `@react-grab/design-system`
package + `/design-system` Next.js route into a proper Storybook 10 app at
`apps/storybook`. Gallery now lives outside the website build, runs
standalone at :6006, and covers each overlay component in isolation.

- Playground story mirrors the old full-scene preview with arg controls
- Components/SelectionLabel, ContextMenu, Toolbar, CommentsDropdown each
  expose their real states (idle / prompt / copying / copied / error,
  collapsed edges, comment presets, long-name truncation)
- Shared fixtures + demo bounds + noop helper keep stories lean
- Scoped `no-unassigned-vars: off` for *.tsx in root vp lint config so
  Solid's `ref={varName}` shorthand doesn't trip the linter
- Drop `vp check` duplication across per-package scripts; rely on root
- Fix two pre-existing `no-useless-escape` lint warnings in cli and
  find-unique-selector regexes
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 19, 2026

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

Project Deployment Actions Updated (UTC)
gym Ready Ready Preview, Comment Apr 19, 2026 11:34am
react-grab-website Ready Ready Preview, Comment Apr 19, 2026 11:34am

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/cli@306
npm i https://pkg.pr.new/aidenybai/react-grab/grab@306
npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/mcp@306
npm i https://pkg.pr.new/aidenybai/react-grab@306

commit: 09440ae

Comment thread apps/storybook/README.md
│ ├── main.ts ← Storybook config
│ └── preview.tsx ← global parameters & CSS import
└── stories/
├── constants.ts ← shared magic numbers (ms, px)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
├── constants.ts ← shared magic numbers (ms, px)
├── demo-bounds.ts ← shared magic numbers (ms, px)

README.md references non-existent constants.ts file instead of the actual demo-bounds.ts file

Fix on Vercel

@aidenybai aidenybai merged commit 811bd5d into main Apr 20, 2026
16 checks passed
@aidenybai aidenybai deleted the storybook-migration branch April 20, 2026 03:20
aidenybai added a commit that referenced this pull request Apr 20, 2026
Follow-up to #306: wire the existing `canvasDecorator` (preview.tsx) and
`assertMounted` helper (assertions.ts) into all five story files that
were still hand-rolling the wrapping and `waitFor` assertion blocks.

- Drop `<Canvas>` wrapping from every `render()` — the decorator now
  handles full-viewport styling globally
- Replace 5 copies of `waitFor(() => expect(...).not.toBeNull())` with
  single-line `assertMounted(canvasElement, "[data-...]")` calls
- Extract the sample dashboard JSX from `renderer.stories.tsx` into the
  already-created `SampleDashboard` component, trimming the renderer
  story from 444 → 240 lines
- Playground `NoSelection` path now uses `assertNotMounted` instead of
  an `if/else` inside `waitFor`
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