Skip to content
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

feat: add basic local storybook implementation for newspack-ui #3770

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

thomasguillot
Copy link
Contributor

@thomasguillot thomasguillot commented Feb 21, 2025

All Submissions:

Changes proposed in this Pull Request:

  • Introduces a new Storybook setup for Newspack UI components

    • Stories are stored inside a dedicated /storybook directory at the root level
    • Configures Storybook to use our CSS-only components
    • Adds comprehensive documentation for each component
  • Creates initial component stories:

    1. Button

      • Documents all variants (primary, secondary, branded, ghost, outline, destructive)
      • Shows size options (x-small, small, medium)
      • Demonstrates layout modifiers (wide, icon, loading)
    2. Segmented Control

      • Shows basic implementation with tabs and panels
      • Documents size options and wide layout
  • Change the default size of the icon-only button to be medium, just like a regular button.

    • It means I had to update Reader Activation modals and elements
    • I also added the inner spans (glyph and text) for buttons using icons

Note: My goal is to ultimately have a dedicated Github page.

How to test the changes in this Pull Request:

  1. Install and run Storybook:

    npm install
    npm run storybook

    Storybook should open at http://localhost:6006

  2. In Storybook's sidebar, verify:

    • Components are listed under "Newspack UI"
    • Both Button and Segmented Control components are present
  3. Test Button component:

    • Check all variants render correctly (Primary, Secondary, etc.)
    • Try different sizes using the controls panel
    • Test layout options (wide, icon-only)
    • Verify loading state works
    • Ensure all interactive examples work as expected
  4. Test Segmented Control component:

    • Verify tabs switch content correctly
    • Test different sizes using the controls panel
    • Check the wide layout option
    • Ensure selected states are visually correct
  5. Verify documentation:

    • Code examples should update when changing controls
    • All modifiers should be properly documented
    • CSS classes should match what's being used
  6. Check if the Reader Activation modals and elements are sized correctly

    • Mainly buttons that are using icon + text or icon-only

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@thomasguillot thomasguillot force-pushed the add/storybook-base branch 5 times, most recently from 7aa2f14 to f4dd9a5 Compare February 22, 2025 07:18
@thomasguillot thomasguillot self-assigned this Feb 22, 2025
@thomasguillot thomasguillot added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 22, 2025
@thomasguillot thomasguillot changed the title Add/storybook base feat: add basic local storybook implementation for newspack-ui Feb 22, 2025
@thomasguillot thomasguillot force-pushed the add/storybook-base branch 2 times, most recently from ad6665f to 00694ca Compare February 22, 2025 07:27
@thomasguillot thomasguillot marked this pull request as ready for review February 22, 2025 08:04
@thomasguillot thomasguillot requested a review from a team as a code owner February 22, 2025 08:04
@thomasguillot
Copy link
Contributor Author

@laurelfulford Why was the default size for icon-only buttons set to x-small, while regular buttons default to medium? I’ve updated this behaviour so that all buttons now default to medium.

@dkoo
Copy link
Contributor

dkoo commented Feb 25, 2025

When I run npm run storybook I get an error message:

Screenshot 2025-02-25 at 11 55 32 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The issue or pull request needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants