Skip to content

Commit 02c6cdb

Browse files
Biki-dasBIKI DAShoxyq
authored andcommitted
feat:-Added a delete all filters action and added title to the add filter a… (facebook#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 <[email protected]> Co-authored-by: Ruslan Lesiutin <[email protected]>
1 parent fcf5191 commit 02c6cdb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/react-devtools-shared/src/devtools/views/Settings/ComponentsSettings.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ export default function ComponentsSettings(_: {}): React.Node {
218218
});
219219
}, []);
220220

221+
const removeAllFilter = () => {
222+
setComponentFilters([]);
223+
};
224+
221225
const toggleFilterIsEnabled = useCallback(
222226
(componentFilter: ComponentFilter, isEnabled: boolean) => {
223227
setComponentFilters(prevComponentFilters => {
@@ -434,11 +438,16 @@ export default function ComponentsSettings(_: {}): React.Node {
434438
))}
435439
</tbody>
436440
</table>
437-
438-
<Button onClick={addFilter}>
441+
<Button onClick={addFilter} title="Add filter">
439442
<ButtonIcon className={styles.ButtonIcon} type="add" />
440443
Add filter
441444
</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+
)}
442451
</div>
443452
);
444453
}

0 commit comments

Comments
 (0)