-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[ResourceList] Add alternateTool
prop
#812
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
d5a2fe6
to
9654ce7
Compare
Before I get into your questions, my first reaction is this PR desperately needs some test coverage. But you were probably planning on following up with that. So here are my answers to your questions:
I think this rationale makes sense. The tools need a slot to make this component more flexible for other use-cases.
I'm not crazy about using the word
I don't think that using this component should have any side effects. It should be up to the consumer whether sorting gets rendered, or it should follow the default behavior of the component. If this replaces the sort component visually, it might make sense just to allow |
I think this makes sense and gives a level of flexibility for the different teams.
I agree with @danrosenthal on this. Not crazy about using
I think having the option to render both makes sense. One thing to think about is how this looks on smaller screens. |
Yes thats the thing on small screen there really isn’t much room, it breaks the layout really quickly. On slack we discussed using ‘alternateTool’ which would make it more clear that this would replace the sort. |
customTool
propalternateTool
prop
That makes sense. I was getting hung up on the additional prop. Re-reading @danrosenthal 's comment makes more sense to me now.
|
9654ce7
to
9026a47
Compare
9026a47
to
cd6987f
Compare
cd6987f
to
e2c3d61
Compare
e2c3d61
to
06b6064
Compare
50f1361
to
fcf7f91
Compare
This PR has been updated to use For now this is complete with tests, and a style-guide example. |
alternateTool
propalternateTool
prop
fcf7f91
to
7b9844f
Compare
7b9844f
to
2f6176c
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.
Looks good. Might be worth beefing up the rationale a bit, otherwise I think this is good to go. Nice test coverage!
|
||
### Resource list with alternate tool | ||
|
||
Allows merchants to add an alternate tool in the current sort option location. |
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.
Might be worth adding some rationale on why they would want to do this.
}, | ||
]; | ||
|
||
const alternateTool = <div testID="AlternateTool">Alternate Tool</div>; |
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.
Should we use a regular id here? 😄
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.
🙈 done.
2f6176c
to
1f59700
Compare
WHY are these changes introduced?
This PR is put in place to achieve this without needing to fork the list.
Currently the only item that can go in the top right of the
ResourceList
is theResourceList.Sort
. There are instances where that area could be used for different content. In this particular case a popover of edit actions.WHAT is this pull request doing?
Adding a prop of
customTool
that can take anyReactNode
Note that this customTool is added instead of the sort, because the current design does not lend itself well to having more than 1 popover on that row.
Before completing this PR with tests I'm looking for feedback on
Do we want to do this? The reason I am for it is because this looks like an easy win to add some level of flexibility to the list. Worth preventing another fork imo.
How do we feel about
alternateTool
as a prop name.Options of this being rendered as oppose to Sort instead of giving the option of rendering both the Sort and the Custom Tool.
How to 🎩
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist