-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Add Filter Panel delete icon slot #4069
[DataGrid] Add Filter Panel delete icon slot #4069
Conversation
These are the results for the performance tests:
|
Thanks for the contribution, I updated your message such that when merging this PR it closes the related issue. Here is the list of keywords to link PR to issue |
@@ -287,7 +286,7 @@ function GridFilterForm(props: GridFilterFormProps) { | |||
onClick={handleDeleteFilter} | |||
size="small" | |||
> | |||
<GridCloseIcon fontSize="small" /> |
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.
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've added a conditional logic to fix this issue but I believe that's not the best approach, since icons are used directly from svg's and there could be a component to render the icons, used globally with props such as size and etc.
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 have a suggested approach for using the icons more efficiently in my mind, but that'll require some time since they're being used in a lot of places. I'll create a separate PR for that once I'm able to figure out the best approach
82f176a
to
6477e96
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.
I merged master
such that we can check the icon is still the same (I added a test to catch this regression)
{rootProps.components.FilterPanelDeleteIcon?.name ? | ||
<rootProps.components.FilterPanelDeleteIcon /> | ||
: <GridCloseIcon fontSize="small" />} |
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.
Why using rootProps.components.FilterPanelDeleteIcon?.name
as a criterion? Any icon created by createSvgIcon()
will have a name.
A simpler solution would be to set <rootProps.components.FilterPanelDeleteIcon fontSize="small" />
The drawback is that all the icons will receive the prop fontSize="small"
with no way to change it.
If developers want to use big icons, they can ignore the prop as follow:
const MyBigIcon = () => <CloseIcon fontSize="large" />
<DataGrid components={{ FilterPanelDeleteIcon: MyBigIcon }} />
@Hameezr Does that sound good to you?
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.
Yes, this will solve the problem and add some customizability as well! Thanks for the suggestion, will make this 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.
Thanks for your contribution, this feature will be available in next release :)
Fix #4063