11import { format } from "date-fns" ;
2- import { it } from "node:test" ;
32import { IHomeWorship } from "type" ;
43
54interface IHomeworshipListItemProps {
@@ -8,37 +7,42 @@ interface IHomeworshipListItemProps {
87}
98const HomeworshipListItem = ( { item, onClick } : IHomeworshipListItemProps ) => {
109 const imageUrl = item . imageUrls ?. [ 0 ] ?? "/images/home/homeworship.png" ;
11- const date = item . date ? format ( new Date ( item . date ) , "yyyy.MM.dd" ) : format ( new Date ( item . createdAt ) , "yyyy.MM.dd" ) ;
10+ const date = item . date
11+ ? format ( new Date ( item . date ) , "yyyy.MM.dd" )
12+ : format ( new Date ( item . createdAt ) , "yyyy.MM.dd" ) ;
1213
1314 return (
1415 < div
1516 onClick = { onClick }
16- className = "flex cursor-pointer flex-col gap-3 rounded-lg border border-gray-200 bg-white p-3 shadow-sm transition-shadow hover:shadow-md sm:gap-4 sm:p-4 "
17+ className = "group cursor-pointer overflow-hidden rounded-xl border border-gray-100 bg-white shadow-sm transition-shadow hover:shadow-md"
1718 >
18- { /* 날짜 및 작성자 */ }
19- < div className = "flex items-center justify-between text-xs text-gray-500 sm:text-sm" >
20- < span > { date } </ span >
21- < span className = "text-blue-900" > { item . userName } </ span >
22- </ div >
23-
24- { /* 썸네일 및 제목 */ }
25- < div className = "flex gap-3 sm:gap-4" >
26- { imageUrl && (
27- < div className = "h-16 w-16 flex-shrink-0 overflow-hidden rounded bg-gray-100 sm:h-20 sm:w-20 md:h-24 md:w-24" >
28- < img src = { imageUrl } alt = { item . title || "가정예배 이미지" } className = "h-full w-full object-cover" />
19+ { /* 썸네일 */ }
20+ < div className = "relative aspect-square w-full overflow-hidden bg-gray-100" >
21+ < img
22+ src = { imageUrl }
23+ alt = { item . title || "가정예배 이미지" }
24+ className = "h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
25+ />
26+ { item . comments ?. length > 0 && (
27+ < div className = "absolute bottom-1.5 right-1.5 flex items-center gap-0.5 rounded-full bg-black/60 px-1.5 py-0.5 text-white sm:bottom-2 sm:right-2 sm:gap-1 sm:px-3 sm:py-1" >
28+ < svg className = "size-3.5 sm:size-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
29+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
30+ </ svg >
31+ < span className = "text-xs font-bold sm:text-sm" > { item . comments . length } </ span >
2932 </ div >
3033 ) }
31- < div className = "flex flex-1 flex-col justify-center" >
32- < h3 className = "line-clamp-2 break-keep text-sm font-medium text-gray-800 sm:text-base md:text-lg" >
33- { item . title || "예배 갤러리_맞있는 가정예배 인증해주셔서 감사합니다" }
34- </ h3 >
35- </ div >
3634 </ div >
3735
38- { /* 자세히 보기 버튼 */ }
39- < button className = "w-full rounded border border-gray-300 bg-white py-2 text-xs font-medium text-gray-700 transition-colors hover:bg-[#2d4a6f] hover:text-white sm:py-2.5 sm:text-sm" >
40- 자세히 보기
41- </ button >
36+ { /* 정보 */ }
37+ < div className = "p-2 sm:p-3" >
38+ < h3 className = "line-clamp-2 break-keep text-xs font-medium text-gray-800 sm:text-sm" >
39+ { item . title || "가정예배 갤러리" }
40+ </ h3 >
41+ < div className = "mt-1 flex items-center justify-between text-[10px] text-gray-400 sm:text-xs" >
42+ < span className = "text-blue-900" > { item . userName } </ span >
43+ < span > { date } </ span >
44+ </ div >
45+ </ div >
4246 </ div >
4347 ) ;
4448} ;
0 commit comments