-
Notifications
You must be signed in to change notification settings - Fork 15
feat: component Collection storybook #4272
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
Conversation
d6cf7a3 to
3498637
Compare
3498637 to
85298de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the Collection component to provide more flexibility in creating new items and controlling when items can be added. The changes include making the newItem prop accept either a static value or a function for dynamic item generation, extending allowAdd to accept boolean values in addition to functions, and refactoring the Storybook stories for better demonstration and maintainability.
Key changes:
- Enhanced
newItemprop to support both static values and factory functions for dynamic item creation - Extended
allowAddprop to accept boolean values for simpler enable/disable logic - Refactored Storybook stories to use a simplified demo with dynamic item generation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| packages/mantine/src/components/Collection/Collection.tsx | Enhanced newItem and allowAdd props to support additional type signatures, updated item creation logic, repositioned error display |
| packages/mantine/src/components/Collection/Collection.module.css | Added flex-wrap: nowrap to prevent item wrapping |
| packages/storybook/src/form/Collection.stories.tsx | Simplified stories by replacing complex form examples with a minimal demo using placeholder items |
| packages/figma/src/Collection.figma.tsx | Updated Figma code connect configuration with proper prop mappings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
refactor(figma): remove CodeConnectBS in Collection
85298de to
76385df
Compare
Proposed Changes
This pull request updates the
Collectioncomponent in the Mantine package to improve its flexibility and simplify its usage, especially in Storybook stories. The main changes include making thenewItemandallowAddprops more flexible, updating the logic for adding new items, and refactoring the Storybook stories for better maintainability and demonstration.Component API improvements:
newItemprop inCollectionPropsnow accepts either a value or a function that returns a value, allowing for dynamic creation of new items.allowAddprop inCollectionPropscan now be a boolean or a function, providing more control over when items can be added.Collectioncomponent was updated to support the newnewItemsignature, ensuring correct item creation at runtime.Styling update:
.itemclass in theCollection.module.cssfile now usesflex-wrap: nowrap;to prevent items from wrapping, improving layout consistency.Storybook refactor and simplification:
Collectionwere refactored to use a simplified demo with dynamic item creation, removal of unused imports, and a new placeholder item component, making the stories easier to maintain and understand.Potential Breaking Changes
Acceptance Criteria