File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,24 @@ const Projects: NextPage = () => {
3636 getProjects ( ) ;
3737 } , [ ] ) ;
3838
39+
40+ const handleSearch = ( e : React . FormEvent < HTMLFormElement > ) => {
41+ e . preventDefault ( ) ;
42+
43+ if ( ! projects ) return ;
44+
45+ const filteredProjects = projects . filter ( project =>
46+ project . title . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) ||
47+ project . techStack . some ( stack => stack . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) )
48+ ) ;
49+
50+ setProjectSearchResults ( filteredProjects ) ;
51+ } ;
52+
3953 return (
4054 < PageLayout title = "PWOC | Projects" description = "List of projects in PWoC" >
4155 < div >
42- < Search onSearch = { ( e ) => { e . preventDefault ( ) ; } } searchTerm = { searchTerm } setSearchTerm = { setSearchTerm } />
56+ < Search onSearch = { handleSearch } searchTerm = { searchTerm } setSearchTerm = { setSearchTerm } />
4357 { ! projects ? (
4458 isClient && < Lottie animationData = { loading } loop className = "h-[200px] w-auto" />
4559 ) : projectSearchResults . length > 0 ? (
You can’t perform that action at this time.
0 commit comments