generated from chingu-voyages/voyage-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
269 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import moment from "moment"; | ||
import Link from "next/link"; | ||
import { type Course } from "@/types"; | ||
|
||
export default function CourseCard({ course }: { course: Course }) { | ||
return ( | ||
<Link | ||
key={course.id} | ||
className="p-4 border border-gray-200 dark:border-gray-700 rounded-lg shadow-md hover:shadow-lg transition-shadow duration-200 dark:bg-gray-800 bg-white" | ||
data-testid="course" | ||
href={`/courses/${course.slug}`} | ||
> | ||
<div className="flex justify-between items-center mb-2"> | ||
<div className="flex items-center gap-1 text-sm text-gray-500 dark:text-gray-400"> | ||
{course.difficulty} | ||
</div> | ||
<span className="text-sm text-gray-500 dark:text-gray-400"> | ||
{moment.duration(course.duration).humanize()} | ||
</span> | ||
</div> | ||
<div className="relative h-40 mb-2 overflow-hidden rounded-lg"> | ||
<img | ||
src={course.thumbnail} | ||
alt={course.title} | ||
width={200} | ||
height={200} | ||
className="absolute inset-0 object-cover object-center w-full h-full" | ||
/> | ||
</div> | ||
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-1"> | ||
{course.title} | ||
</h2> | ||
<p className="text-sm text-gray-500 dark:text-gray-400 mb-2"> | ||
{course.shortDescription} | ||
</p> | ||
|
||
<div className="flex justify-between items-center mt-4"> | ||
<span className="text-sm text-gray-500 dark:text-gray-400"> | ||
{course?.instructor?.name} | ||
</span> | ||
</div> | ||
</Link> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.