Skip to content

Commit

Permalink
feat: checkpoint 1
Browse files Browse the repository at this point in the history
  • Loading branch information
devsargam committed Mar 25, 2024
1 parent 128f8c2 commit 4333d9a
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/components/Courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,31 @@
import { Course } from '@prisma/client';
import { CourseCard } from './CourseCard';
import { useRouter } from 'next/navigation';
import { RefreshDb } from './RefreshDb';

export const Courses = ({ courses }: { courses: Course[] }) => {
const router = useRouter();
return (
<div className="max-w-screen-xl w-full mx-auto py-6 px-6 cursor-pointer grid grid-cols-1 gap-5 md:grid-cols-3">
{courses?.map((course) => (
<CourseCard
key={course.id}
course={course}
onClick={() => {
if (
course.title.includes('Machine Learning') ||
course.title.includes('Harnoor')
) {
router.push('https://harkirat.classx.co.in/');
} else {
router.push(`/courses/${course.id}`);
}
}}
/>
))}
</div>
<section className="flex flex-col items-center w-full">
<div className="max-w-screen-xl w-full mx-auto py-6 px-6 cursor-pointer grid grid-cols-1 gap-5 md:grid-cols-3">
{courses?.map((course) => (
<CourseCard
key={course.id}
course={course}
onClick={() => {
if (
course.title.includes('Machine Learning') ||
course.title.includes('Harnoor')
) {
router.push('https://harkirat.classx.co.in/');
} else {
router.push(`/courses/${course.id}`);
}
}}
/>
))}
</div>
<RefreshDb />
</section>
);
};

0 comments on commit 4333d9a

Please sign in to comment.