feat(LanguageSelector): convert stories to args-based pattern#62
feat(LanguageSelector): convert stories to args-based pattern#62garrity-miepub merged 3 commits intomainfrom
Conversation
Deploying ui with
|
| Latest commit: |
51b88f9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://679f23fd.ui-6d0.pages.dev |
| Branch Preview URL: | https://feature-language-selector-up.ui-6d0.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR modernizes the LanguageSelector component stories by converting them from render-based stories with wrapper components to an args-based pattern that integrates with Storybook's controls. The changes include adding default args and comprehensive argTypes with descriptions, removing wrapper components, adding individual variant stories (Ghost, Minimal, Small, Large), and replacing hardcoded colors with design tokens for better dark mode support.
Changes:
- Converted stories from render-based pattern with state management wrappers to args-based pattern
- Added default args and comprehensive argTypes with descriptions for better Storybook controls integration
- Replaced hardcoded color classes with design tokens (text-muted-foreground, border-border, bg-card, etc.)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Convert render-based stories to args-based for controls integration - Add default args and comprehensive argTypes with descriptions - Remove unused wrapper components - Add individual Ghost, Minimal, Small, Large stories - Replace hardcoded colors with design tokens for dark mode
36b0d4e to
fe4ed88
Compare
…stories Address Copilot review feedback on PR #62: - Add LanguageSelectorWithState wrapper component that manages internal state with React.useState, similar to SelectWithState pattern - Wrapper syncs with Storybook controls via useEffect when value changes - Convert AllVariantsComparison to named function with independent state for each selector type (dropdown, native, inline) - Convert InHeader to named function with proper state management This fixes the issue where controlled components weren't responding to user interactions - clicking a language option now updates the display while still allowing Storybook controls to work properly.
Addressed Copilot Review CommentsThanks for the thorough review! All three feedback items have been addressed in commit ecab3b2: 1. Default Story State Management (Line 71)Added
2. AllVariantsComparison State Management (Line 132)Converted to a named function component
Each selector now responds to user interactions while staying in sync with Storybook controls. 3. InHeader State Management (Line 151)Converted to a named function component Testing: All stories now properly respond to both:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… object Address additional Copilot review feedback on PR #62: - Update comment to clarify LanguageSelectorWithState is the primary Storybook component wrapper (Line 17) - Fix handleChange to receive Language object and extract .code (Line 51) - Fix LanguageSelector onChange: (language) => setDropdownValue(language.code) (Line 189) - Fix LanguageSelectorNative onChange: (language) => setNativeValue(language.code) (Line 197) - Fix LanguageSelectorInline onChange: (language) => setInlineValue(language.code) (Line 205) - Fix InHeader LanguageSelector onChange: (language) => setValue(language.code) (Line 231) The onChange callback receives a Language object (with code, name, flag properties), not just a string. All handlers now properly extract language.code from the object to match the component's API.
Addressed Additional Copilot Review Comments (Round 2)All 6 new feedback items have been addressed in commit 51b88f9: API Signature Mismatch FixesThe core issue was that
This ensures the stories correctly match the component's API contract where |
language-selector.mov