From d2bc4e346d37c91c31c765356492bf3458a5fbc0 Mon Sep 17 00:00:00 2001 From: Rohit Shambwani Date: Mon, 12 Dec 2022 11:39:48 +0530 Subject: [PATCH] Adding shuffle buttton --- client/src/components/Label/Label.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/src/components/Label/Label.jsx b/client/src/components/Label/Label.jsx index dbd796ef..4f28a517 100644 --- a/client/src/components/Label/Label.jsx +++ b/client/src/components/Label/Label.jsx @@ -28,6 +28,12 @@ const Label = React.memo(({ name, color, size, isDisabled, onClick }) => { )} > {name || '\u00A0'} + ); @@ -56,3 +62,12 @@ Label.defaultProps = { }; export default Label; +const filteredItems = useMemo( + () => + items.filter( + (label) => + (label.name && label.name.toLowerCase().includes(cleanSearch)) || + label.color.includes(cleanSearch), + ), + [items, cleanSearch], +);