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 = () => {
2424 if ( searchParams . has ( QueryParams . SEARCH ) ) {
2525 return data
2626 . 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+ } ) ;
3437 }
3538 return data . find ( ( item ) => item . name === category ) ?. snippets ;
3639 } , [ category , data , searchParams ] ) ;
You can’t perform that action at this time.
0 commit comments