Skip to content

Commit d964acb

Browse files
committed
Search bar fixed
1 parent ac2b921 commit d964acb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pages/projects.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff 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 ? (

public/sw.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)