feat(WEB-38, WEB-9, WEB-19): add static page for sponsoring, add Header and add Footer

This commit is contained in:
Christel Westerberg
2024-01-12 16:03:50 +01:00
parent 0a208923f8
commit bb90e2bf50
69 changed files with 3739 additions and 27 deletions

View File

@@ -0,0 +1,52 @@
import { notFound } from "next/navigation";
import fs from "node:fs/promises";
import path from "node:path";
import Header from "@/components/Current/Header";
import type { Params, SearchParams } from "@/types/params";
export default async function CurrentContentPage({
params,
searchParams,
}: Params<SearchParams>) {
try {
const filePath = path.join(
process.cwd(),
"mockCms",
params.lang,
searchParams.uri,
"data.json"
);
const data = await fs.readFile(filePath, { encoding: "utf-8" });
if (!data) {
throw new Error("No data");
}
const json = JSON.parse(data);
return (
<>
<Header lang={params.lang} pathname={searchParams.uri} />
{json.hero ? (
<div
dangerouslySetInnerHTML={{ __html: json.hero }}
className="hero-content-overlay"
/>
) : null}
{json.content ? (
<main
className="main l-sections-wrapper"
role="main"
id="maincontent"
dangerouslySetInnerHTML={{ __html: json.content }}
/>
) : null}
</>
);
} catch (err) {
return notFound();
}
}