Skip to content

Commit f02f682

Browse files
Merge pull request #17 from CodeCompasss/club
Club
2 parents b420201 + 67c724f commit f02f682

2 files changed

Lines changed: 99 additions & 9 deletions

File tree

src/app/club/[slug]/page.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// app/club/[slug]/page.tsx
22
import { notFound } from 'next/navigation';
3-
import clubData from '@/components/club/ClubData';
43

5-
export default async function ClubDetailPage({
6-
params,
7-
}: {
8-
params: Promise<{ slug: string }>; // 🚨 params must be a Promise
9-
}) {
10-
const { slug } = await params; // 🚨 await it before using
4+
import clubData from 'src/components/club/ClubData';
5+
import ClubDetail from '@/components/club/ClubDetail';
6+
7+
export default async function ClubDetailPage({ params }: { params: { slug: string } }) {
8+
const { slug } = await Promise.resolve(params); // simulate async destructuring
119

1210
const club = clubData.find((c) => c.slug === slug);
1311
if (!club) notFound();
14-
15-
return <h1>Club Details: {slug}</h1>;
12+
return <ClubDetail club={club} />;
1613
}

src/components/club/ClubDetail.tsx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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

Comments
 (0)