The CMS serves a second banner at /api/v1/offerings/banner?position=top. The site bakes it into the HTML at build time and replaces it live after hydration, like the banner under the cards, and both may show at once. The cards now sit in a wrapping flex row so an incomplete last row is centred for any number of cards on desktop; phone and tablet stay one column. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
79 lines
3.1 KiB
TypeScript
79 lines
3.1 KiB
TypeScript
import { createFileRoute } from '@tanstack/react-router';
|
|
import Hero from '../components/Hero/Hero';
|
|
import InstagramGrid from '../components/InstagramGrid/InstagramGrid';
|
|
import AboutBlock from '../components/home/AboutBlock/AboutBlock';
|
|
import ContactSection from '../components/home/ContactSection/ContactSection';
|
|
import Pricing from '../components/home/Pricing/Pricing';
|
|
import Testimonials from '../components/home/Testimonials/Testimonials';
|
|
import IntroGallery from '../components/home/IntroGallery/IntroGallery';
|
|
import heroContent from '../content/heroContent';
|
|
import homeContent from '../content/homeContent';
|
|
import instagramContent from '../content/instagramContent';
|
|
import {
|
|
useBanner,
|
|
useTopBanner,
|
|
usePackages,
|
|
} from '../components/PackagesProvider/PackagesProvider';
|
|
import testimonials from '../content/testimonials';
|
|
import siteContent from '../content/siteContent';
|
|
import { visibleSocials } from '../lib/visibleSocials';
|
|
import useHydrated from '../hooks/useHydrated';
|
|
import { pageHead } from '../seo';
|
|
|
|
// ?pakket= from a "Boek" link on a price card. Only text is kept; whether it
|
|
// names a real package is checked against the shown packages (BR-PARAM-01).
|
|
type HomeSearch = { pakket?: string };
|
|
|
|
export const Route = createFileRoute('/')({
|
|
validateSearch: (search: Record<string, unknown>): HomeSearch =>
|
|
typeof search.pakket === 'string' ? { pakket: search.pakket } : {},
|
|
head: () => pageHead('/'),
|
|
component: Index,
|
|
});
|
|
|
|
// The homepage: the hero, then the sections in the order of LAYOUT.md
|
|
function Index() {
|
|
const packages = usePackages();
|
|
const banner = useBanner();
|
|
const topBanner = useTopBanner();
|
|
const { pakket: searched } = Route.useSearch();
|
|
// The search only counts after hydration, so the prerendered HTML and the
|
|
// first browser render agree (BR-HYD-10)
|
|
const pakket = useHydrated() ? searched : undefined;
|
|
// Without a valid https link the tiles would lead nowhere: no section
|
|
const instagram = visibleSocials(siteContent.socials).find(
|
|
(social) => social.platform === 'instagram',
|
|
);
|
|
return (
|
|
<>
|
|
<Hero content={heroContent} socials={siteContent.socials} />
|
|
<IntroGallery content={homeContent.intro} />
|
|
<AboutBlock content={homeContent.about} />
|
|
<Pricing
|
|
content={homeContent.pricing}
|
|
packages={packages}
|
|
banner={banner}
|
|
topBanner={topBanner}
|
|
/>
|
|
<Testimonials
|
|
content={homeContent.testimonials}
|
|
testimonials={testimonials}
|
|
/>
|
|
<ContactSection
|
|
content={homeContent.contact}
|
|
packages={packages}
|
|
enabled={siteContent.contactForm.enabled}
|
|
email={siteContent.email}
|
|
replyTime={siteContent.contactForm.replyTime}
|
|
pakket={pakket}
|
|
/>
|
|
{instagram && (
|
|
<InstagramGrid
|
|
content={instagramContent}
|
|
profileUrl={instagram.href}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
}
|