|
| 1 | + |
| 2 | +'use client'; |
| 3 | + |
| 4 | +import { Instagram, Linkedin, ChevronDown, ArrowLeftIcon } from 'lucide-react'; |
| 5 | +import { useState } from 'react'; |
| 6 | +import { useRouter } from 'next/navigation'; |
| 7 | +import Image from 'next/image'; |
| 8 | + |
| 9 | +type Club = { |
| 10 | + name: string; |
| 11 | + slug: string; |
| 12 | + description: string; |
| 13 | + image: string; |
| 14 | + socials: { |
| 15 | + instagram?: string; |
| 16 | + linkedin?: string; |
| 17 | + whatsapp?: string; |
| 18 | + }; |
| 19 | +}; |
| 20 | + |
| 21 | +export default function ClubDetail({ club }: { club: Club }) { |
| 22 | + const [open, setOpen] = useState(false); |
| 23 | + const router = useRouter(); |
| 24 | + |
| 25 | + return ( |
| 26 | + <div className="flex flex-col min-h-screen text-black bg-white"> |
| 27 | + |
| 28 | + {/* --- Header with Background Image --- */} |
| 29 | + <div className="relative w-full h-48 md:h-72 lg:h-96 border-b border-bottom-width: 2px"> |
| 30 | + <Image |
| 31 | + src={club.image} |
| 32 | + alt={club.name} |
| 33 | + fill |
| 34 | + className="object-cover" |
| 35 | + priority |
| 36 | + /> |
| 37 | + {/* Back Button */} |
| 38 | + <button |
| 39 | + onClick={() => router.push('/club')} |
| 40 | + className="absolute top-4 left-4 w-10 h-10 flex items-center justify-center rounded-full border border-gray-400 bg-white" |
| 41 | + > |
| 42 | + <ArrowLeftIcon className="w-5 h-5" /> |
| 43 | + </button> |
| 44 | + |
| 45 | + {/* Dropdown Menu */} |
| 46 | + <div className="absolute top-4 right-4"> |
| 47 | + <button |
| 48 | + onClick={() => setOpen(!open)} |
| 49 | + className="w-10 h-10 flex items-center justify-center rounded-full border border-gray-400 bg-white " |
| 50 | + > |
| 51 | + <ChevronDown className="w-4 h-4" /> |
| 52 | + </button> |
| 53 | + |
| 54 | + {open && ( |
| 55 | + <div className="absolute right-0 mt-2.5 bg-white border rounded-md shadow-md p-2 flex flex-col gap-2 z-50"> |
| 56 | + {club.socials.instagram && ( |
| 57 | + <a |
| 58 | + href={club.socials.instagram} |
| 59 | + target="_blank" |
| 60 | + rel="noopener noreferrer" |
| 61 | + className="hover:text-pink-600" |
| 62 | + > |
| 63 | + <Instagram className="w-5 h-5" /> |
| 64 | + </a> |
| 65 | + )} |
| 66 | + {club.socials.linkedin && ( |
| 67 | + <a |
| 68 | + href={club.socials.linkedin} |
| 69 | + target="_blank" |
| 70 | + rel="noopener noreferrer" |
| 71 | + className="hover:text-blue-700" |
| 72 | + > |
| 73 | + <Linkedin className="w-5 h-5" /> |
| 74 | + </a> |
| 75 | + )} |
| 76 | + {/*update other social media links */} |
| 77 | +</div> |
| 78 | + |
| 79 | + )} |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + |
| 83 | + {/* --- Main Content --- */} |
| 84 | + <div className="p-6"> |
| 85 | + <h1 className="text-3xl font-bold mb-1">{club.name}</h1> |
| 86 | + <p className="text-sm text-gray-600 mb-4">subtitle</p> |
| 87 | + <p className="text-base text-black leading-relaxed indent-8"> |
| 88 | + {club.description} |
| 89 | + </p> |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + ); |
| 93 | +} |
0 commit comments