Skip to content

feat: Add Storybook for component documentation#11

Open
slmingol wants to merge 12 commits intoand-computers:mainfrom
slmingol:feature/storybook-setup
Open

feat: Add Storybook for component documentation#11
slmingol wants to merge 12 commits intoand-computers:mainfrom
slmingol:feature/storybook-setup

Conversation

@slmingol
Copy link
Copy Markdown

@slmingol slmingol commented Feb 21, 2026

Overview

This PR adds Storybook for component documentation and visual development, providing a foundation for design system documentation.

Changes

Storybook Installation

  • Storybook 10.2.10 with React-Vite framework
  • Essential addons configured:
    • @chromatic-com/storybook - Visual testing integration
    • @storybook/addon-vitest - Component unit testing
    • @storybook/addon-a11y - Accessibility checks
    • @storybook/addon-docs - Automatic documentation generation

Component Stories

Created comprehensive example stories:

  • WordButton: Interactive word selection with multiple scenarios (short/long words, selection states)
  • Button: All design system variants (default, destructive, submit, outline, secondary, ghost, link, share) and sizes (sm, default, lg, icon)
  • Badge: All variants with practical game status examples (default, secondary, destructive, outline)

Configuration Files

  • .storybook/main.js - Storybook configuration with addons
  • .storybook/preview.js - Global story parameters and decorators
  • .storybook/vitest.setup.js - Vitest integration for component testing
  • vite.config.js - Vite configuration for JSX support in .js files

Testing

  • Integrated with Vitest for component testing
  • All 24 tests passing (3 component story test suites)
  • Tests run via npm run test:run

Benefits

  • Interactive component development and testing
  • Visual documentation for design system
  • Accessibility testing integration
  • Component unit testing via Vitest
  • Design system showcase

Testing

npm run storybook         # Start Storybook dev server (port 6006)
npm run build-storybook   # Build static Storybook site
npm test                  # Run all tests including Storybook component tests

Note on JSX Files

This PR works with the current .js file extensions. However, modern build tools prefer JSX in .jsx files. The JSX refactor PR (#14) addresses this to make Storybook fully optimized.

Dependencies

This PR builds upon:

From Fork

https://github.com/slmingol/react-connections-game

smingolelli and others added 12 commits February 20, 2026 22:00
- Add Dockerfile with Node.js build and Nginx production stages
- Add docker-compose.yml for local development with build
- Add docker-compose.simple.yml for running from GHCR
- Add .dockerignore to optimize build context
- Use Debian-based Node image for ARM compatibility
- Upgrade React & React DOM to v19.2.4
- Upgrade date-fns from v2 to v4
- Upgrade prettier from v2 to v3
- Upgrade react-spring from v9 to v10
- Upgrade query-string from v8 to v9
- Upgrade tailwind-merge from v1 to v3
- Upgrade ua-parser-js from v1 to v2
- Upgrade Parcel to v2.16.4
- Upgrade lucide-react to v0.575.0
- Upgrade Tailwind CSS to v3.4.19
- Upgrade all @radix-ui packages to latest versions
- Upgrade other dependencies to latest compatible versions

All tests passing with legacy peer deps for React 19 compatibility
- Upgrade to Node 20 (required by rimraf@6 and other packages)
- Switch from npm ci to npm install --legacy-peer-deps for React 19
- Upgrade to Node 20 (required by rimraf@6 and other packages)
- Switch from npm ci to npm install --legacy-peer-deps for React 19
chore: Update Dockerfile for React 19 compatibility
- Remove obsolete docker-compose version attribute
- Update dev service from Node 18 to Node 20
- Remove unused eslint and eslint-config-react-app packages
- Add package overrides to force secure versions of minimatch and glob
- Fixes all 21 high severity security vulnerabilities (now 0)

This resolves GHSA-3ppc-4f35-3m26 (minimatch ReDoS vulnerability) and
eliminates all transitive dependencies on vulnerable package versions.
fix: Address critical security and configuration issues
- Add .nvmrc for consistent Node 20 environment
- Enhance package.json scripts (start, clean, format, format:check, test)
- Add GitHub Actions CI/CD workflow
  - Runs on push to main and PRs
  - Format check, tests, and build verification
  - Docker image build and push to GHCR (main branch only)
- Setup Vitest testing framework
  - Configured for JSX support in .js files
  - Includes React Testing Library and jsdom
  - Added example test for WordButton component
  - Test scripts: test, test:ui, test:run, test:coverage

All tests passing (4/4) with 0 vulnerabilities maintained.
feat: Add developer experience improvements
- Update React 18 → React 19
- Add Node 20 prerequisite and .nvmrc mention
- Add Docker setup instructions (local build and GHCR image)
- Document all npm scripts (start, test, format, clean, etc.)
- Add testing section with Vitest and React Testing Library
- Add CI/CD section explaining GitHub Actions workflow
- Enhance Contributing section with development requirements
- Note --legacy-peer-deps flag requirement
- Add technology stack updates (Vitest, Docker, Node 20)
docs: Update README with React 19, Docker, testing, and CI/CD info
- Install Storybook 10.2.10 with React-Vite framework
- Configure Storybook with essential addons:
  - @chromatic-com/storybook for visual testing
  - @storybook/addon-vitest for component testing integration
  - @storybook/addon-a11y for accessibility checks
  - @storybook/addon-docs for automatic documentation
- Add vite.config.js for JSX support in .js files
- Create example stories:
  - WordButton: Interactive word selection with multiple scenarios
  - Button: All design system button variants and sizes
  - Badge: Badge variants with game status examples
- Update README with Storybook documentation and known limitation
- Add storybook and build-storybook npm scripts

Note: Storybook requires refactoring React component files from .js to .jsx
extensions to work properly. This is due to the non-standard practice of using
.js extensions for JSX content. Example stories are provided as reference for
when this refactoring is completed.

Future work: Rename all React component files to use .jsx extension for full
Storybook compatibility.
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.

2 participants