Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
chore: add no courses indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Firgrep committed Jul 21, 2024
1 parent 36a542f commit 73b6174
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/CourseGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import CourseCard from "./CourseCard";
import { dbGetAllPublishedCourses } from "@/server/controllers/dbController";
import Heading from "./Heading";

export default async function CourseGrid () {
export default async function CourseGrid() {
const courses = await dbGetAllPublishedCourses();

if (courses.length === 0) {
return (
<Heading as="h6">
No courses available. Please check in at a later time.
</Heading>
);
}

return (
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 px-6'>
{courses.map(course => (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 px-6">
{courses.map((course) => (
<CourseCard key={course.id} course={course} />
))}
</div>
);
};
}

0 comments on commit 73b6174

Please sign in to comment.