@samitouri / QOS-React / commits / a3743b2e44

feat:-Added a delete all filters action and added title to the add filter a… (#27332)

### changes 1. A small action added to delete all filters, it can be useful to delete when someone has a bunch of them rather than clicking on them selectively. 2.There was no title on the `add filter` button so added the same https://github.com/facebook/react/assets/72331432/af6c0725-05b6-4f46-b8c9-8079bd933a8e review @hoxyq --------- Co-authored-by: BIKI DAS <bikidas@BIKIs-MacBook-Pro.local> Co-authored-by: Ruslan Lesiutin <rdlesyutin@gmail.com>

BIKI DAS committed Sep 20, 2023 at 14:56 UTC a3743b2e444d2198972b190a9d97c3edcf370414
1 file changed +11 -2
packages/react-devtools-shared/src/devtools/views/Settings/ComponentsSettings.js
+11 -2
@@ -218,6 +218,10 @@ export default function ComponentsSettings(_: {}): React.Node {
218 });
219 }, []);
220
221 + const removeAllFilter = () => {
222 + setComponentFilters([]);
223 + };
224 +
225 const toggleFilterIsEnabled = useCallback(
226 (componentFilter: ComponentFilter, isEnabled: boolean) => {
227 setComponentFilters(prevComponentFilters => {
@@ -434,11 +438,16 @@ export default function ComponentsSettings(_: {}): React.Node {
438 ))}
439 </tbody>
440 </table>
437 -
438 - <Button onClick={addFilter}>
441 + <Button onClick={addFilter} title="Add filter">
442 <ButtonIcon className={styles.ButtonIcon} type="add" />
443 Add filter
444 </Button>
445 + {componentFilters.length > 0 && (
446 + <Button onClick={removeAllFilter} title="Delete all filters">
447 + <ButtonIcon className={styles.ButtonIcon} type="delete" />
448 + Delete all filters
449 + </Button>
450 + )}
451 </div>
452 );
453 }