Skip to content

Commit c3b9028

Browse files
fix: not found text after using search with no results (closes #35)
1 parent 863e341 commit c3b9028

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

app/page.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,32 @@ const Home: NextPage = () => {
3131
placeholder="Search exams"
3232
className="mb-6 px-4 py-2 border border-gray-300 rounded-md w-3/4 lg:w-1/2"
3333
/>
34-
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-10 gap-y-5 mx-5 lg:mx-0">
35-
{filteredExams.map((exam) => (
36-
<NameLink
37-
key={exam.name}
38-
href={{
39-
pathname: "/modes",
40-
query: { url: exam.url, name: exam.name },
41-
}}
42-
heading={exam.name}
43-
paragraph={exam.subtitle}
44-
wrapperClassNames="hover:bg-[#C7D2E2]"
45-
headingClassNames="group-hover:from-[#fff] group-hover:to-[#fff]"
46-
/>
47-
))}
34+
<div
35+
className={`grid ${
36+
filteredExams.length > 0
37+
? "grid-cols-1 sm:grid-cols-2 gap-x-10 gap-y-5"
38+
: "flex justify-center items-center"
39+
} mx-5 lg:mx-0`}
40+
>
41+
{filteredExams.length > 0 ? (
42+
filteredExams.map((exam) => (
43+
<NameLink
44+
key={exam.name}
45+
href={{
46+
pathname: "/modes",
47+
query: { url: exam.url, name: exam.name },
48+
}}
49+
heading={exam.name}
50+
paragraph={exam.subtitle}
51+
wrapperClassNames="hover:bg-[#C7D2E2]"
52+
headingClassNames="group-hover:from-[#fff] group-hover:to-[#fff]"
53+
/>
54+
))
55+
) : (
56+
<p className="text-white text-lg mt-4">
57+
No exams were found for your query.
58+
</p>
59+
)}
4860
</div>
4961
</div>
5062
);

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)