-
Notifications
You must be signed in to change notification settings - Fork 84
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
LF-4084: Update table/2 to include checkboxes and row selection behaviour #3149
LF-4084: Update table/2 to include checkboxes and row selection behaviour #3149
Conversation
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.
It looks good to me!
I think the only thing I would consider adding is a clear all on the story when the select all is checked.
…ckboxes_and_row_selection_behaviour
onCheck, | ||
handleSelectAllClick, |
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.
I wonder if these two could be combined and simplified by passing a setSelectedIds
function prop instead, and letting the table handle the different scenarios where the selected IDs need to change
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.
It's possible, but I'm hesitant to do it.
A few of my concerns:
- flexibility - what if we want to do something else when checkbox is clicked?
- duplicated
handleSelectAllClick
- we will have a function for this in its parent component anyways because we have "clear selection" in the action menu
Are they not a big deal??
Update:
I figured that handleSelectAllClick
should be like this:
const handleSelectAllClick = (e) => {
if (e.target.checked) {
setSelectedIds(data.map(({ id }) => id));
} else {
setSelectedIds([]);
}
};
Considering we will have to write this in parent components, I am not sure which is better...
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.
Those are good points, this was just a suggestion but I think either way is alright!
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.
@SayakaOno happy to approve but I think this morning the other table pr was merged so there are now conflicts
…ckboxes_and_row_selection_behaviour
Description
NOTE: I didn't apply the new checkbox style as it seems like it would require a good amount of effort.
Jira link: https://lite-farm.atlassian.net/browse/LF-4084
Type of change
How Has This Been Tested?
Checklist: