Skip to content

Conversation

@qdhenry
Copy link

@qdhenry qdhenry commented Jun 21, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

Adds missing controls to the StoryBook stories
CleanShot 2025-06-21 at 12 06 00

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The existing Storybook stories lacked interactive controls, making it difficult for developers to explore and experiment with GraphCanvas features. limited ability to understand available options and their visual effects.

Issue Number: N/A

What is the new behavior?

Storybook stories now feature comprehensive interactive controls with 20+ GraphCanvas properties that can be adjusted in real-time. Stories have been converted to use the template pattern with .bind({}) and include shared argTypes configuration. Users can now interactively explore:

  • Layout algorithms (13 options: forceDirected2d/3d, hierarchical, circular, etc.)
  • Camera modes (pan, rotate, orbit)
  • Themes (light, dark, custom)
  • Sizing strategies (centrality, pageRank, attribute-based)
  • Label visibility modes
  • Edge styling options
  • Selection and interaction modes
  • Advanced features like clustering, collapsing, and custom rendering (WIP)

This transforms the Storybook into an interactive playground that dramatically improves developer experience and library discoverability.

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

Work In Progress Notes:

  • I understand the introduction of controls on all stories make some stories redundant, will need to explore which controls make the most since where, but for now unlocking full interactivity for all props against all components.
  • Camera control stories not yet implemented
  • Some TypeScript errors may exist with event handler prop conflicts in complex stories
  • Event handlers in stories with custom selection logic (UseCases, ContextMenu) may need refinement
  • All stories build successfully but runtime testing of all controls is needed

Files Modified:

  • story files updated with comprehensive controls
  • 1 shared configuration file created (docs/shared/storybook-args.ts)

Technical Implementation:

  • Consistent template pattern across all stories
  • Shared argTypes prevent code duplication
  • Maintains existing functionality while adding interactivity

qdhenry added 2 commits June 20, 2025 20:58
- Added shared argTypes configuration with 20+ controls for GraphCanvas props
- Converted functional stories to template functions with .bind({}) pattern
- Added interactive controls for:
  * Layout algorithms (13 options)
  * Camera modes (pan, rotate, orbit)
  * Themes (light, dark, custom)
  * Sizing strategies (5 options)
  * Label visibility (5 options)
  * Edge styling and arrow positioning
  * Interactive features (dragging, selection, etc.)

Completed: Basic, Nodes, Edges, Layouts, Themes, Controls, Sizing,
Selection, EdgeArrows, EdgeCurved, EdgeLabels, Labels, ContextMenu, RadialMenu
Add comprehensive interactive controls to remaining story files including
cluster stories, layout stories, and use case examples. All stories now
use consistent template pattern with .bind({}) and shared argTypes.

Changes:
- Convert Cluster.story.tsx remaining functional stories to template pattern
- Update TwoLayouts.story.tsx with controls for all 6 layout examples
- Update UseCases.story.tsx with controls for complex use case stories
- Ensure consistent pattern across all 24 story files

WORK IN PROGRESS:
- Pending TypeScript error cleanup for event handlers
- Some stories have event handler prop conflicts causing TS errors
- Need to resolve storybook args vs component prop type mismatches

All stories build successfully but may have runtime issues with event
handlers that need to be addressed in follow-up commits.
@qdhenry qdhenry added the enhancement New feature or request label Jun 21, 2025
@netlify
Copy link

netlify bot commented Jun 21, 2025

Deploy Preview for reagraph ready!

Name Link
🔨 Latest commit 730c899
🔍 Latest deploy log https://app.netlify.com/projects/reagraph/deploys/6856db80f4fc6c000889405a
😎 Deploy Preview https://deploy-preview-337--reagraph.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants