-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathAboutPage.tsx
97 lines (82 loc) · 2.94 KB
/
AboutPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use client';
import React from 'react';
import { Divider, NoData } from '@/components/ui';
import { useForumData } from '@/context/ForumDataContext';
import { renderContent } from '@/utils/quillUtils';
// Reusable component for a two-column row with a bold title on the left.
type SectionRowProps = {
title: string;
children: React.ReactNode;
};
const SectionRow: React.FC<SectionRowProps> = ({ title, children }) => (
<div className="py-4 flex flex-col md:flex-row items-start transition duration-150 ease-in-out hover:bg-gray-50 rounded">
<div className="md:w-1/3 mb-2 md:mb-0 text-left text-xl font-bold">
{title}
</div>
<div className="md:w-2/3 text-left space-y-4">{children}</div>
</div>
);
const AboutPage = () => {
const data = useForumData();
if (!data || !data.introduction) {
return <NoData />;
}
console.info(data);
// Objectives Section: Render each objective as a SectionRow
const renderObjectives = () => {
const objectives = data?.engagement?.objectives || [];
return (
<section className="space-y-6">
<h2 className="text-2xl font-bold text-left">Objectives</h2>
<div className="divide-y divide-gray-200">
{objectives.map((objective: any) => (
<SectionRow key={objective.id} title={objective.title}>
{objective.details}
</SectionRow>
))}
</div>
</section>
);
};
return (
<div className="w-full px-6 lg:px-0 bg-white">
<Divider className="bg-black p-0 m-0 h-[1px] w-full max-w-5xl mx-auto" />
{/* Main Content */}
<div className="max-w-5xl mx-auto space-y-12 py-8">
{/* Introduction Section (kept out of the redesign) */}
<section className="space-y-6">
<h2 className="text-2xl font-bold text-left">Introduction</h2>
<div
className="prose"
dangerouslySetInnerHTML={{
__html: renderContent(data.introduction),
}}
/>
</section>
{/* Objectives Section */}
{renderObjectives()}
<Divider className="bg-black p-0 m-0 h-[1px] w-full max-w-5xl mx-auto" />
{/* Sponsorship Opportunities Section */}
<SectionRow title="Sponsorship Opportunities">
<div
dangerouslySetInnerHTML={{
__html: renderContent(
data?.sponsorship_opportunities_about || '',
),
}}
/>
</SectionRow>
<Divider className="bg-black p-0 m-0 h-[1px] w-full max-w-5xl mx-auto" />
{/* Sponsorship Packages Section */}
<SectionRow title="Sponsorship Packages">
<div
dangerouslySetInnerHTML={{
__html: renderContent(data?.sponsorship_packages || ''),
}}
/>
</SectionRow>
</div>
</div>
);
};
export default AboutPage;