-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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: SimpleFormIterator
clear item call action
#8302
Conversation
This looks really good! |
Target is changed to Thanks! |
22bfc7c
to
a842231
Compare
Could you rebase? |
I'm asking this just to be sure :) |
Sure, right now, your history shows changes in 61 files. It is difficult to follow |
a842231
to
f01152d
Compare
f01152d
to
a842231
Compare
a842231
to
27c093e
Compare
You've added a story for storybook, but you need to add unit tests as well and documentation |
Hi, and thanks for your PR. I'm not fond of the UI you're proposing. The "refresh" icon is misleading in this case, and the icon color should be the same as the 'remove item' icon since it's a destructive action. |
27c093e
to
40ed981
Compare
docs/SimpleFormIterator.md
Outdated
@@ -70,6 +70,7 @@ const OrderEdit = () => ( | |||
| Prop | Required | Type | Default | Description | | |||
|----------|----------|----------------|-----------------------|-------------------------------------| | |||
| `addButton` | Optional | `ReactElement` | - | Component to render for the add button | | |||
| `clearButton` | Optional | `boolean` | `true` | When `false`, the user cannot clear the array | |
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.
If it's a simple boolean, then the prop name isn't right.
In general, we prefer to define boolean props that take the value true
when used, so:
<SimpleFormIterator disableClear>
is preferable to:
<SimpleFormIterator clearButton={false}>
In addition, we already have other disableXXX
props for this component, so for consistency this prop should follow the same pattern.
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.
updated : b987e62
docs/SimpleFormIterator.md
Outdated
@@ -94,6 +95,10 @@ This prop lets you pass a custom element to replace the default Add button. | |||
</SimpleFormIterator> | |||
``` | |||
|
|||
## `clearButton` | |||
|
|||
This prop lets you pass a custom element to replace the default "Clear the list" button |
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.
That's not true anymore
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.
Removed and disableClear
description is added : b987e62
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.
Almost there!
</div> | ||
)} | ||
<div className={SimpleFormIteratorClasses.buttons}> | ||
{!disabled && !disableAdd && ( |
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.
In the DisableAdd story, I see that this also disables the ClearButton...
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.
Indeed, disableAdd
condition should not effect to disableClear
resolve commit : 2f21d4d
</div> | ||
)} | ||
<div className={SimpleFormIteratorClasses.buttons}> | ||
{!disabled && ( |
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.
But then if both disableAdd
and disableRemove
are true, we will insert an empty div for nothing...
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.
Thanks |
This PR is related to this issue : #8287
Screen.Recording.2022-10-25.at.12.21.05.mov