feat(home): birthday section, map embed, and CMS-driven news title/subtitle
- Add BirthdayPricing section to home page (was missing entirely) - Add MapSection component rendering Google Maps iframe from CMS embedUrl - News component now accepts title/subtitle props from CMS sectionTitles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
97f775afcb
commit
1b64b79129
4 changed files with 69 additions and 6 deletions
|
|
@ -2,10 +2,12 @@ import { Hero } from '@/components/sections/Hero'
|
|||
import { Locations } from '@/components/sections/Locations'
|
||||
import { WhyParents } from '@/components/sections/WhyParents'
|
||||
import { VideoSection } from '@/components/sections/VideoSection'
|
||||
import { BirthdayPricing } from '@/components/sections/BirthdayPricing'
|
||||
import { Gallery } from '@/components/sections/Gallery'
|
||||
import { Reviews } from '@/components/sections/Reviews'
|
||||
import { News } from '@/components/sections/News'
|
||||
import { FAQ } from '@/components/sections/FAQ'
|
||||
import { MapSection } from '@/components/sections/MapSection'
|
||||
import { getHomeData } from '@/lib/getHomeData'
|
||||
import { RefreshRouteOnSave } from '@/components/cms/RefreshRouteOnSave'
|
||||
import { JsonLd } from '@/components/seo/JsonLd'
|
||||
|
|
@ -22,7 +24,7 @@ const STATIC_HERO: NonNullable<HomePageHero> = {
|
|||
}
|
||||
|
||||
export default async function HomePage() {
|
||||
const { home, locations, reviews } = await getHomeData()
|
||||
const { home, locations, reviews, birthdayPackages } = await getHomeData()
|
||||
|
||||
const heroData = home?.hero
|
||||
const hero = heroData?.title ? heroData : STATIC_HERO
|
||||
|
|
@ -38,13 +40,25 @@ export default async function HomePage() {
|
|||
title={home?.sectionTitles?.whyParents ?? undefined}
|
||||
/>
|
||||
<VideoSection poster={home?.video?.poster ?? undefined} src={home?.video?.src ?? undefined} />
|
||||
<BirthdayPricing
|
||||
packages={birthdayPackages.length > 0 ? birthdayPackages : undefined}
|
||||
title={home?.sectionTitles?.birthday ?? undefined}
|
||||
intro={home?.birthdayIntro?.text ?? undefined}
|
||||
/>
|
||||
<Gallery
|
||||
images={home?.gallery?.images ?? undefined}
|
||||
title={home?.sectionTitles?.gallery ?? undefined}
|
||||
/>
|
||||
<Reviews data={reviews} title={home?.sectionTitles?.reviews ?? undefined} />
|
||||
<FAQ items={home?.faq?.items ?? undefined} title={home?.faq?.title ?? undefined} />
|
||||
<News />
|
||||
<News
|
||||
title={home?.sectionTitles?.news ?? undefined}
|
||||
subtitle={home?.news?.subtitle ?? undefined}
|
||||
/>
|
||||
<MapSection
|
||||
embedUrl={home?.map?.embedUrl ?? undefined}
|
||||
address={home?.map?.address ?? undefined}
|
||||
/>
|
||||
<RefreshRouteOnSave />
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
35
src/components/sections/MapSection.tsx
Normal file
35
src/components/sections/MapSection.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
interface MapSectionProps {
|
||||
embedUrl?: string | null
|
||||
address?: string | null
|
||||
}
|
||||
|
||||
export function MapSection({ embedUrl, address }: MapSectionProps) {
|
||||
if (!embedUrl) return null
|
||||
|
||||
return (
|
||||
<section className="py-[20px] md:py-[60px] lg:py-[40px]">
|
||||
<div className="mx-auto max-w-[1204px] px-8">
|
||||
{address && (
|
||||
<p
|
||||
className="mb-6 text-[16px] text-[#272727]"
|
||||
style={{ fontFamily: 'var(--font-poppins, Poppins), sans-serif', fontWeight: 300 }}
|
||||
>
|
||||
{address}
|
||||
</p>
|
||||
)}
|
||||
<div className="overflow-hidden rounded-[20px]" style={{ height: 450 }}>
|
||||
<iframe
|
||||
src={embedUrl}
|
||||
width="100%"
|
||||
height="100%"
|
||||
style={{ border: 0 }}
|
||||
allowFullScreen
|
||||
loading="lazy"
|
||||
referrerPolicy="no-referrer-when-downgrade"
|
||||
title="Карта Шуміленд"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
@ -63,7 +63,12 @@ async function getLatestPosts(limit = 3): Promise<Article[]> {
|
|||
}
|
||||
}
|
||||
|
||||
export async function News() {
|
||||
interface NewsProps {
|
||||
title?: string | null
|
||||
subtitle?: string | null
|
||||
}
|
||||
|
||||
export async function News({ title, subtitle }: NewsProps = {}) {
|
||||
const posts = await getLatestPosts(3)
|
||||
|
||||
const articles =
|
||||
|
|
@ -84,14 +89,14 @@ export async function News() {
|
|||
className="text-[24px] font-bold text-[#272727] uppercase md:text-[32px]"
|
||||
style={{ fontFamily: 'var(--font-montserrat, Montserrat), sans-serif' }}
|
||||
>
|
||||
Новини
|
||||
{title ?? 'Новини'}
|
||||
</h2>
|
||||
<p
|
||||
className="text-[16px] text-[#272727]"
|
||||
style={{ fontFamily: 'var(--font-poppins, Poppins), sans-serif', fontWeight: 300 }}
|
||||
>
|
||||
Дізнавайтеся серед перших про нові події у парку, щоб не пропустити цікаві квести,
|
||||
фестивалі та пригоди
|
||||
{subtitle ??
|
||||
'Дізнавайтеся серед перших про нові події у парку, щоб не пропустити цікаві квести, фестивалі та пригоди'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -103,9 +103,17 @@ export interface HomePageBirthdayIntro {
|
|||
|
||||
export interface HomePageNews {
|
||||
title?: string | null
|
||||
subtitle?: string | null
|
||||
limit?: number | null
|
||||
}
|
||||
|
||||
export interface HomePageMap {
|
||||
embedUrl?: string | null
|
||||
address?: string | null
|
||||
lat?: number | null
|
||||
lng?: number | null
|
||||
}
|
||||
|
||||
export interface HomePageFaqItem {
|
||||
question?: string | null
|
||||
answer?: string | null
|
||||
|
|
@ -126,6 +134,7 @@ export interface HomePageGlobal {
|
|||
birthdayIntro?: HomePageBirthdayIntro | null
|
||||
news?: HomePageNews | null
|
||||
faq?: HomePageFaq | null
|
||||
map?: HomePageMap | null
|
||||
updatedAt?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue