File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,16 @@ export const useSnippets = () => {
24
24
if ( searchParams . has ( QueryParams . SEARCH ) ) {
25
25
return data
26
26
. find ( ( item ) => item . name === category )
27
- ?. snippets . filter ( ( item ) =>
28
- item . title
29
- . toLowerCase ( )
30
- . includes (
31
- ( searchParams . get ( QueryParams . SEARCH ) || "" ) . toLowerCase ( )
32
- )
33
- ) ;
27
+ ?. snippets . filter ( ( item ) => {
28
+ const searchTerm = (
29
+ searchParams . get ( QueryParams . SEARCH ) || ""
30
+ ) . toLowerCase ( ) ;
31
+ return (
32
+ item . title . toLowerCase ( ) . includes ( searchTerm ) ||
33
+ item . description . toLowerCase ( ) . includes ( searchTerm ) ||
34
+ item . tags . some ( ( tag ) => tag . toLowerCase ( ) . includes ( searchTerm ) )
35
+ ) ;
36
+ } ) ;
34
37
}
35
38
return data . find ( ( item ) => item . name === category ) ?. snippets ;
36
39
} , [ category , data , searchParams ] ) ;
You can’t perform that action at this time.
0 commit comments