@@ -8,9 +8,43 @@ interface BlogCardProps {
88 date : string ;
99 link : string ;
1010 imageUrl : string ;
11+ tags : string [ ] ;
1112}
1213
13- export const BlogCard = ( { title, description, date, link, imageUrl } : BlogCardProps ) => {
14+ export const BlogCard = ( { title, description, date, link, imageUrl, tags } : BlogCardProps ) => {
15+
16+ const getTagColor = ( tag : string ) => {
17+ const colors : { [ key : string ] : string } = {
18+ 'java' : 'bg-red-100 text-red-800' ,
19+ 'python' : 'bg-blue-100 text-blue-800' ,
20+ 'c++' : 'bg-purple-100 text-purple-800' ,
21+ 'javascript' : 'bg-yellow-100 text-yellow-800' ,
22+ 'typescript' : 'bg-blue-100 text-blue-800' ,
23+ 'kotlin' : 'bg-purple-100 text-purple-800' ,
24+ 'c' : 'bg-gray-100 text-gray-800' ,
25+ 'html' : 'bg-orange-100 text-orange-800' ,
26+ 'css' : 'bg-pink-100 text-pink-800' ,
27+ 'shell' : 'bg-green-100 text-green-800' ,
28+ 'ruby' : 'bg-red-100 text-red-800' ,
29+ 'swift' : 'bg-orange-100 text-orange-800' ,
30+ 'go' : 'bg-cyan-100 text-cyan-800' ,
31+ 'rust' : 'bg-orange-100 text-orange-800' ,
32+ 'arduino' : 'bg-teal-100 text-teal-800' ,
33+ 'android' : 'bg-green-100 text-green-800' ,
34+ 'aws' : 'bg-blue-100 text-blue-800' ,
35+ 'sns' : 'bg-green-100 text-green-800' ,
36+ 'sqs' : 'bg-yellow-100 text-yellow-800' ,
37+ 's3' : 'bg-orange-100 text-orange-800' ,
38+ 'lambda' : 'bg-purple-100 text-purple-800' ,
39+ 'architecture' : 'bg-gray-100 text-gray-800' ,
40+ 'clean' : 'bg-teal-100 text-teal-800' ,
41+ 'design' : 'bg-pink-100 text-pink-800' ,
42+ 'adr' : 'bg-red-100 text-red-800'
43+ } ;
44+
45+ return colors [ tag ] || 'bg-gray-100 text-gray-800' ;
46+ }
47+
1448 return (
1549 < div className = "bg-white rounded-lg shadow-[0_3px_10px_rgb(0,0,0,0.2)] overflow-hidden hover:shadow-[0_8px_30px_rgb(0,0,0,0.12)] transition-all duration-300 transform hover:-translate-y-1" >
1650 < a
@@ -34,9 +68,13 @@ export const BlogCard = ({ title, description, date, link, imageUrl }: BlogCardP
3468 < div className = "p-6" >
3569 < div className = "flex items-center justify-between mb-4" >
3670 < span className = "text-sm text-gray-500" > { date } </ span >
37- < span className = "px-3 py-1 text-xs font-medium text-blue-600 bg-blue-100 rounded-full" >
38- Gist
39- </ span >
71+ < div className = "flex flex-wrap gap-2" >
72+ { tags . map ( ( tag : string ) => (
73+ < span key = { tag } className = { `px-2 py-1 rounded-full text-xs font-medium ${ getTagColor ( tag ) } ` } >
74+ { tag }
75+ </ span >
76+ ) ) }
77+ </ div >
4078 </ div >
4179 < h3 className = "text-xl font-bold text-gray-900 mb-2 group-hover:text-blue-600 transition-colors duration-300" >
4280 { title }
0 commit comments