|
| 1 | +import { ScrollArea } from '@/components/ui/scroll-area'; |
| 2 | +import { useNavigate } from 'react-router'; |
| 3 | +import type { Events } from '../types/schema'; |
| 4 | +import { formatEventDate } from '../utils/date'; |
| 5 | + |
| 6 | +interface Props { |
| 7 | + schedule: Events; |
| 8 | +} |
| 9 | + |
| 10 | +// 아이콘 |
| 11 | +const IconChevronLeft = () => ( |
| 12 | + <svg |
| 13 | + width="24" |
| 14 | + height="24" |
| 15 | + viewBox="0 0 24 24" |
| 16 | + fill="none" |
| 17 | + stroke="currentColor" |
| 18 | + strokeWidth="2" |
| 19 | + strokeLinecap="round" |
| 20 | + strokeLinejoin="round" |
| 21 | + > |
| 22 | + <path d="m15 18-6-6 6-6" /> |
| 23 | + </svg> |
| 24 | +); |
| 25 | + |
| 26 | +export default function EventDetailContent({ schedule }: Props) { |
| 27 | + const navigate = useNavigate(); |
| 28 | + |
| 29 | + return ( |
| 30 | + <div className="w-full flex flex-col items-start gap-10"> |
| 31 | + {/* 1. 일시 및 장소 */} |
| 32 | + <div className="text-left space-y-3 w-full"> |
| 33 | + <p className="text-lg sm:text-xl font-bold text-black"> |
| 34 | + 일시 {formatEventDate(schedule.start_at)} |
| 35 | + </p> |
| 36 | + <p className="text-lg sm:text-xl font-bold text-black"> |
| 37 | + 장소 {schedule.location || '미정'} |
| 38 | + </p> |
| 39 | + </div> |
| 40 | + |
| 41 | + {/* 2. 신청 현황 버튼 */} |
| 42 | + <button |
| 43 | + onClick={() => navigate('guests')} |
| 44 | + className="flex items-center text-lg font-bold group hover:opacity-70 transition-opacity" |
| 45 | + > |
| 46 | + {schedule.capacity}명 중{' '} |
| 47 | + <span className="text-black ml-2 font-extrabold"> |
| 48 | + {/* 신청 인원 필드 필요 */}8명 신청 |
| 49 | + </span> |
| 50 | + <div className="rotate-180 ml-2 group-hover:translate-x-1 transition-transform text-black"> |
| 51 | + <IconChevronLeft /> |
| 52 | + </div> |
| 53 | + </button> |
| 54 | + |
| 55 | + {/* 3. 상세 설명 */} |
| 56 | + <ScrollArea className="h-40 w-full rounded-md border-none"> |
| 57 | + <p className="text-base text-gray-500 leading-relaxed whitespace-pre-wrap pr-4"> |
| 58 | + {schedule.description} |
| 59 | + </p> |
| 60 | + </ScrollArea> |
| 61 | + |
| 62 | + {/* 4. 마감 정보 (버튼 상단 문구) */} |
| 63 | + <p className="text-lg font-bold text-black"> |
| 64 | + {schedule.registration_deadline |
| 65 | + ? `${formatEventDate(schedule.registration_deadline)} 모집 마감` |
| 66 | + : '상시 모집'} |
| 67 | + </p> |
| 68 | + </div> |
| 69 | + ); |
| 70 | +} |
0 commit comments