feat(WEB-38, WEB-9, WEB-19): add static page for sponsoring, add Header and add Footer
This commit is contained in:
52
app/[lang]/current-content-page/page.tsx
Normal file
52
app/[lang]/current-content-page/page.tsx
Normal 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();
|
||||
}
|
||||
}
|
||||
58
app/[lang]/layout.tsx
Normal file
58
app/[lang]/layout.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import "../core.css";
|
||||
import "../scandic.css";
|
||||
|
||||
import Footer from "@/components/Current/Footer";
|
||||
import LangPopup from "@/components/Current/LangPopup";
|
||||
import Script from "next/script";
|
||||
import SkipToMainContent from "@/components/SkipToMainContent";
|
||||
|
||||
import type { Metadata } from "next";
|
||||
import type { Params } from "@/types/params";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
description: "New web",
|
||||
title: "Scandic Hotels New Web",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
params,
|
||||
}: React.PropsWithChildren<Params>) {
|
||||
return (
|
||||
<html lang={params.lang}>
|
||||
<head>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/head.js?85c84c9e24ae8da3e7af"
|
||||
data-cookieconsent="ignore"
|
||||
/>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/inline.js?00133e5a37de35c51a5d"
|
||||
data-cookieconsent="ignore"
|
||||
/>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/ng/polyfills.js?1701356813379"
|
||||
data-cookieconsent="ignore"
|
||||
/>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/ng/runtime.js?1701356813379"
|
||||
data-cookieconsent="ignore"
|
||||
/>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/ng/main.js?1701356813379"
|
||||
data-cookieconsent="ignore"
|
||||
/>
|
||||
<Script
|
||||
src="https://www.scandichotels.com/Static/dist/js/main-ng.js?2b211af0a0699f1ffcec"
|
||||
data-cookieconsent="ignore"
|
||||
strategy="lazyOnload"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<LangPopup lang={params.lang} />
|
||||
<SkipToMainContent lang={params.lang} />
|
||||
{children}
|
||||
<Footer lang={params.lang} />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
3
app/[lang]/page.tsx
Normal file
3
app/[lang]/page.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function Home() {
|
||||
return <main>Hello world!</main>;
|
||||
}
|
||||
Reference in New Issue
Block a user