1+ // src/components/ProjectCard.tsx
2+
3+ import React from 'react' ;
4+ import { ExternalLink , Star } from "lucide-react" ;
5+ import { SiGithub } from "@icons-pack/react-simple-icons" ;
6+
7+ export interface Project {
8+ id : number ;
9+ studentName : string ;
10+ projectName : string ;
11+ description : string ;
12+ tags : string [ ] ;
13+ projectLink : string ;
14+ githubLink ?: string ;
15+ image : string ;
16+ stars ?: number ;
17+ }
18+
19+ interface ProjectCardProps {
20+ project : Project ;
21+ }
22+
23+ const ProjectCard : React . FC < ProjectCardProps > = ( { project } ) => {
24+ return (
25+ < a
26+ href = { project . projectLink }
27+ className = "bg-white border border-black rounded-md overflow-hidden hover:rotate-3 transition-transform"
28+ >
29+ < img
30+ src = { project . image }
31+ alt = { project . projectName }
32+ className = "w-full h-48 object-cover"
33+ />
34+ < div className = "p-6 border-t border-black" >
35+ < span className = "flex justify-between" >
36+ < h3 className = "text-xl font-semibold text-gray-900 mb-2" >
37+ { project . projectName }
38+ </ h3 >
39+ { ( project . stars || 0 ) > 0 && (
40+ < span className = "flex items-center h-fit w-fit gap-1 bg-yellow-50 border border-yellow-200 px-1 rounded-sm" >
41+ < Star size = { 14 } className = "text-yellow-500 fill-yellow-500" />
42+ { project . stars }
43+ </ span >
44+ ) }
45+ </ span >
46+ < p className = "text-sm text-gray-600 mb-2" >
47+ by { project . studentName }
48+ </ p >
49+ < p className = "text-gray-700 mb-4" > { project . description } </ p >
50+
51+ < div className = "flex flex-wrap gap-2 mb-4" >
52+ { project . tags . map ( ( tag ) => (
53+ < span
54+ key = { tag }
55+ className = "px-3 py-1 border border-black bg-yellow-50 text-black rounded-full text-sm"
56+ >
57+ { tag }
58+ </ span >
59+ ) ) }
60+ </ div >
61+
62+ < div className = "flex flex-wrap gap-4" >
63+ { project . githubLink && (
64+ < a
65+ href = { project . githubLink }
66+ target = "_blank"
67+ rel = "noopener noreferrer"
68+ className = "flex items-center gap-2 p-1 rounded-md text-gray-700 hover:text-white hover:bg-black"
69+ >
70+ < SiGithub size = { 20 } />
71+ < span > Source Code</ span >
72+ </ a >
73+ ) }
74+ < a
75+ href = { project . projectLink }
76+ target = "_blank"
77+ rel = "noopener noreferrer"
78+ className = "flex items-center gap-2 p-1 rounded-md text-gray-700 hover:text-white hover:bg-black"
79+ >
80+ < ExternalLink size = { 20 } />
81+ < span > Project Link</ span >
82+ </ a >
83+ </ div >
84+ </ div >
85+ </ a >
86+ ) ;
87+ } ;
88+
89+ export default ProjectCard ;
0 commit comments