chore: run prettier --write .
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
import "../../core.css";
|
import "../../core.css"
|
||||||
import "../../scandic.css";
|
import "../../scandic.css"
|
||||||
|
|
||||||
import Footer from "@/components/Current/Footer";
|
import Footer from "@/components/Current/Footer"
|
||||||
import LangPopup from "@/components/Current/LangPopup";
|
import LangPopup from "@/components/Current/LangPopup"
|
||||||
import Script from "next/script";
|
import Script from "next/script"
|
||||||
import SkipToMainContent from "@/components/SkipToMainContent";
|
import SkipToMainContent from "@/components/SkipToMainContent"
|
||||||
|
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next"
|
||||||
import type { LangParams, LayoutArgs } from "@/types/params";
|
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||||
import InitLivePreview from "@/components/Current/LivePreview";
|
import InitLivePreview from "@/components/Current/LivePreview"
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
description: "New web",
|
description: "New web",
|
||||||
title: "Scandic Hotels New Web",
|
title: "Scandic Hotels New Web",
|
||||||
};
|
}
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
children,
|
children,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.highlightBlock {
|
.highlightBlock {
|
||||||
padding: 10px 10px 15px;
|
padding: 10px 10px 15px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import type { RTENext, RTEDefaultNode } from "@/types/rte/node"
|
|||||||
import type { RenderOptions } from "@/types/rte/option"
|
import type { RenderOptions } from "@/types/rte/option"
|
||||||
|
|
||||||
export const renderOptions: RenderOptions = {
|
export const renderOptions: RenderOptions = {
|
||||||
[RTETypeEnum.p]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.p]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<p key={node.uid} className={styles.p}>
|
<p key={node.uid} className={styles.p}>
|
||||||
{next(node.children, embeds, fullRenderOptions)}
|
{next(node.children, embeds, fullRenderOptions)}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function Puffs({ puffs }: PuffsProps) {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{puffs.map(puff => (
|
{puffs.map((puff) => (
|
||||||
<Puff key={puff.node.system.uid} {...puff.node} />
|
<Puff key={puff.node.system.uid} {...puff.node} />
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
padding-left: 1.6em;
|
padding-left: 1.6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkmark::before, .disc::before {
|
.checkmark::before,
|
||||||
|
.disc::before {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -30,8 +31,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.checkmark::before {
|
.checkmark::before {
|
||||||
content: url('/Static/img/bullet-list-tick-birch-v2.svg');
|
content: url("/Static/img/bullet-list-tick-birch-v2.svg");
|
||||||
transform: scale(.9);
|
transform: scale(0.9);
|
||||||
left: -1.2em;
|
left: -1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +50,8 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link:active, .link:hover {
|
.link:active,
|
||||||
|
.link:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
export default function Puffs() {
|
export default function Puffs() {
|
||||||
return (
|
return <></>
|
||||||
<>
|
|
||||||
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import JsonToHtml from "@/components/JsonToHtml";
|
import JsonToHtml from "@/components/JsonToHtml"
|
||||||
|
|
||||||
import type { TextProps } from "@/types/components/current/blocks/text"
|
import type { TextProps } from "@/types/components/current/blocks/text"
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,3 @@
|
|||||||
padding: 20px 0 0;
|
padding: 20px 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -40,7 +44,9 @@ export default function DaHeader({ pathname }: HeaderProps) {
|
|||||||
|
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a
|
<a
|
||||||
@@ -178,7 +184,9 @@ export default function DaHeader({ pathname }: HeaderProps) {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -186,5 +194,5 @@ export default function DaHeader({ pathname }: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -7,7 +11,8 @@ import type { HeaderProps } from "@/types/components/current/header"
|
|||||||
import type { LanguageSwitcherLink } from "@/types/components/current/languageSwitcher"
|
import type { LanguageSwitcherLink } from "@/types/components/current/languageSwitcher"
|
||||||
|
|
||||||
const paths: Record<string, LanguageSwitcherLink[]> = {
|
const paths: Record<string, LanguageSwitcherLink[]> = {
|
||||||
"/kundenbetreuung/haufig-gestellte-fragen/nutzung-der-internetseite": currentAboutLinks,
|
"/kundenbetreuung/haufig-gestellte-fragen/nutzung-der-internetseite":
|
||||||
|
currentAboutLinks,
|
||||||
"/scandic-entdecken/wlan": currentWifiLinks,
|
"/scandic-entdecken/wlan": currentWifiLinks,
|
||||||
"/sponsoring": currentSponsoringLinks,
|
"/sponsoring": currentSponsoringLinks,
|
||||||
}
|
}
|
||||||
@@ -21,80 +26,178 @@ export default function DeHeader({ pathname }: HeaderProps) {
|
|||||||
<header className="header" role="banner">
|
<header className="header" role="banner">
|
||||||
<div className="offline-banner hidden">
|
<div className="offline-banner hidden">
|
||||||
Sie sind offline. Manche Inhalte könnten nicht aktuell sein.
|
Sie sind offline. Manche Inhalte könnten nicht aktuell sein.
|
||||||
<button type="button" className="reload">Neu laden</button>
|
<button type="button" className="reload">
|
||||||
|
Neu laden
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="l-section main-header navigation-bar" data-js="main-nav-bar">
|
<div
|
||||||
|
className="l-section main-header navigation-bar"
|
||||||
|
data-js="main-nav-bar"
|
||||||
|
>
|
||||||
<div className="navigation-bar__top navigation-bar__top--ghostwhite-light">
|
<div className="navigation-bar__top navigation-bar__top--ghostwhite-light">
|
||||||
<div className="l-section__inner">
|
<div className="l-section__inner">
|
||||||
<a href="https://www.scandichotels.de" className="scandic-main-page-link">Back to scandichotels.de</a>
|
<a
|
||||||
|
href="https://www.scandichotels.de"
|
||||||
|
className="scandic-main-page-link"
|
||||||
|
>
|
||||||
|
Back to scandichotels.de
|
||||||
|
</a>
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.de/hotelreservation/get-booking">Buchung ansehen/ändern</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.de/hotelreservation/get-booking"
|
||||||
|
>
|
||||||
|
Buchung ansehen/ändern
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.de/karriere-bei-scandic-hotels">Karriere bei Scandic</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.de/karriere-bei-scandic-hotels"
|
||||||
|
>
|
||||||
|
Karriere bei Scandic
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.de/geschaftsreisen">Firmenkunden</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.de/geschaftsreisen"
|
||||||
|
>
|
||||||
|
Firmenkunden
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.de/scandic-friends">Über Scandic Friends</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.de/scandic-friends"
|
||||||
|
>
|
||||||
|
Über Scandic Friends
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="navigation-bar__main">
|
<div className="navigation-bar__main">
|
||||||
<div className="l-section__inner l-section__inner--small-no-padding" itemScope={undefined} itemType="http://schema.org/Organization">
|
<div
|
||||||
|
className="l-section__inner l-section__inner--small-no-padding"
|
||||||
|
itemScope={undefined}
|
||||||
|
itemType="http://schema.org/Organization"
|
||||||
|
>
|
||||||
<meta itemProp="name" content="Scandic" />
|
<meta itemProp="name" content="Scandic" />
|
||||||
<button type="button" className="navigation-bar__main__expander" data-js="main-nav-toggler" data-target="#main-menu" aria-pressed="false">
|
<button
|
||||||
<span className="icon-bars"></span><span className="hidden--accessible">Menu</span>
|
type="button"
|
||||||
|
className="navigation-bar__main__expander"
|
||||||
|
data-js="main-nav-toggler"
|
||||||
|
data-target="#main-menu"
|
||||||
|
aria-pressed="false"
|
||||||
|
>
|
||||||
|
<span className="icon-bars"></span>
|
||||||
|
<span className="hidden--accessible">Menu</span>
|
||||||
</button>
|
</button>
|
||||||
<a id="scandic-logo" className="navigation-bar__main__logo hidden-medium " href="https://www.scandichotels.de" itemProp="url">
|
<a
|
||||||
<span className="hidden--accessible">Back to scandichotels.de</span>
|
id="scandic-logo"
|
||||||
<img src="/Static/img/scandic-logotype.svg" data-js="scandiclogoimg" alt="Scandic Hotels logo" height="22" data-nosvgsrc="/Static/img/scandic-logotype.png" itemProp="logo" />
|
className="navigation-bar__main__logo hidden-medium "
|
||||||
|
href="https://www.scandichotels.de"
|
||||||
|
itemProp="url"
|
||||||
|
>
|
||||||
|
<span className="hidden--accessible">
|
||||||
|
Back to scandichotels.de
|
||||||
|
</span>
|
||||||
|
<img
|
||||||
|
src="/Static/img/scandic-logotype.svg"
|
||||||
|
data-js="scandiclogoimg"
|
||||||
|
alt="Scandic Hotels logo"
|
||||||
|
height="22"
|
||||||
|
data-nosvgsrc="/Static/img/scandic-logotype.png"
|
||||||
|
itemProp="logo"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<ul id="navbar-header-design" className="hidden hidden-medium hidden-large nav-primary__header">
|
<ul
|
||||||
|
id="navbar-header-design"
|
||||||
|
className="hidden hidden-medium hidden-large nav-primary__header"
|
||||||
|
>
|
||||||
<li className="nav-primary__scandicfriendslogo">
|
<li className="nav-primary__scandicfriendslogo">
|
||||||
<img src="/Static/img/icons/scandic-friends/icon-scandic-friends.svg" width="35" height="35" />
|
<img
|
||||||
|
src="/Static/img/icons/scandic-friends/icon-scandic-friends.svg"
|
||||||
|
width="35"
|
||||||
|
height="35"
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul id="main-menu" className="nav-primary is-collapsed" data-collapsable="main-menu">
|
<ul
|
||||||
<li className="nav-primary__item nav-primary__item--primary hidden-large hidden-small hidden-xsmall hidden-xxsmall" aria-hidden="true">
|
id="main-menu"
|
||||||
<a className="navigation-bar__main__logo" href="https://www.scandichotels.de">
|
className="nav-primary is-collapsed"
|
||||||
<img src="/Static/img/scandic-logotype.svg" data-js="scandiclogoimg" alt="Scandic Hotels logo" height="22" data-nosvgsrc="/Static/img/scandic-logotype.png" />
|
data-collapsable="main-menu"
|
||||||
<span className="hidden--accessible">Back to scandichotels.de</span>
|
>
|
||||||
|
<li
|
||||||
|
className="nav-primary__item nav-primary__item--primary hidden-large hidden-small hidden-xsmall hidden-xxsmall"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="navigation-bar__main__logo"
|
||||||
|
href="https://www.scandichotels.de"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/Static/img/scandic-logotype.svg"
|
||||||
|
data-js="scandiclogoimg"
|
||||||
|
alt="Scandic Hotels logo"
|
||||||
|
height="22"
|
||||||
|
data-nosvgsrc="/Static/img/scandic-logotype.png"
|
||||||
|
/>
|
||||||
|
<span className="hidden--accessible">
|
||||||
|
Back to scandichotels.de
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.de/hotelsuche">Hotels & Reiseziele</a>
|
<a href="https://www.scandichotels.de/hotelsuche">
|
||||||
|
Hotels & Reiseziele
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.de/reisemagazin">Reisemagazin</a>
|
<a href="https://www.scandichotels.de/reisemagazin">
|
||||||
|
Reisemagazin
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.de/tagungen-und-events">Tagungen & Events</a>
|
<a href="https://www.scandichotels.de/tagungen-und-events">
|
||||||
|
Tagungen & Events
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.de/scandic-entdecken">Scandic entdecken</a>
|
<a href="https://www.scandichotels.de/scandic-entdecken">
|
||||||
|
Scandic entdecken
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.de/angebote-arrangements">Angebote</a>
|
<a href="https://www.scandichotels.de/angebote-arrangements">
|
||||||
|
Angebote
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
||||||
<a href="https://www.scandichotels.de/scandic-friends">Über Scandic Friends</a>
|
<a href="https://www.scandichotels.de/scandic-friends">
|
||||||
|
Über Scandic Friends
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
||||||
<a href="https://www.scandichotels.de/geschaftsreisen">Geschäftsreisen</a>
|
<a href="https://www.scandichotels.de/geschaftsreisen">
|
||||||
|
Geschäftsreisen
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -8,7 +12,8 @@ import type { LanguageSwitcherLink } from "@/types/components/current/languageSw
|
|||||||
import type { HeaderProps } from "@/types/components/current/header"
|
import type { HeaderProps } from "@/types/components/current/header"
|
||||||
|
|
||||||
const paths: Record<string, LanguageSwitcherLink[]> = {
|
const paths: Record<string, LanguageSwitcherLink[]> = {
|
||||||
"/customer-service/frequently-asked-questions/using-the-website": currentAboutLinks,
|
"/customer-service/frequently-asked-questions/using-the-website":
|
||||||
|
currentAboutLinks,
|
||||||
"/explore-scandic/wifi": currentWifiLinks,
|
"/explore-scandic/wifi": currentWifiLinks,
|
||||||
"/sponsoring": currentSponsoringLinks,
|
"/sponsoring": currentSponsoringLinks,
|
||||||
}
|
}
|
||||||
@@ -40,7 +45,9 @@ export default function EnHeader({ pathname }: HeaderProps) {
|
|||||||
|
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a
|
<a
|
||||||
@@ -175,7 +182,9 @@ export default function EnHeader({ pathname }: HeaderProps) {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -183,5 +192,5 @@ export default function EnHeader({ pathname }: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -8,7 +12,8 @@ import type { LanguageSwitcherLink } from "@/types/components/current/languageSw
|
|||||||
import type { HeaderProps } from "@/types/components/current/header"
|
import type { HeaderProps } from "@/types/components/current/header"
|
||||||
|
|
||||||
const paths: Record<string, LanguageSwitcherLink[]> = {
|
const paths: Record<string, LanguageSwitcherLink[]> = {
|
||||||
"/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista": currentAboutLinks,
|
"/asiakaspalvelu/usein-kysytyt-kysymykset/tietoja-internetsivuista":
|
||||||
|
currentAboutLinks,
|
||||||
"/koe-scandic/maksuton-internetyhteys": currentSponsoringLinks,
|
"/koe-scandic/maksuton-internetyhteys": currentSponsoringLinks,
|
||||||
"/scandic-entdecken/wlan": currentWifiLinks,
|
"/scandic-entdecken/wlan": currentWifiLinks,
|
||||||
}
|
}
|
||||||
@@ -40,7 +45,9 @@ export default function FiHeader({ pathname }: HeaderProps) {
|
|||||||
|
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a
|
<a
|
||||||
@@ -177,7 +184,9 @@ export default function FiHeader({ pathname }: HeaderProps) {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -185,5 +194,5 @@ export default function FiHeader({ pathname }: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { LanguageSwitcherProps } from "@/types/components/current/languageSwitcher";
|
import type { LanguageSwitcherProps } from "@/types/components/current/languageSwitcher"
|
||||||
|
|
||||||
export default function Desktop({
|
export default function Desktop({
|
||||||
currentLanguage,
|
currentLanguage,
|
||||||
@@ -33,5 +33,5 @@ export default function Desktop({
|
|||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,25 @@
|
|||||||
import type { LanguageSwitcherProps } from "@/types/components/current/languageSwitcher"
|
import type { LanguageSwitcherProps } from "@/types/components/current/languageSwitcher"
|
||||||
|
|
||||||
export default function Mobile({ currentLanguage, links }: LanguageSwitcherProps) {
|
export default function Mobile({
|
||||||
|
currentLanguage,
|
||||||
|
links,
|
||||||
|
}: LanguageSwitcherProps) {
|
||||||
return (
|
return (
|
||||||
<div className="navbar-language-selector">
|
<div className="navbar-language-selector">
|
||||||
<button className="navbar-language-selector__toggler " data-js="collapsible-toggler" data-target="language-menu" aria-pressed="false">
|
<button
|
||||||
{currentLanguage} <span className="navbar-language-selector__toggler__arrow"></span><span className="hidden--accessible">Choose language</span>
|
className="navbar-language-selector__toggler "
|
||||||
|
data-js="collapsible-toggler"
|
||||||
|
data-target="language-menu"
|
||||||
|
aria-pressed="false"
|
||||||
|
>
|
||||||
|
{currentLanguage}{" "}
|
||||||
|
<span className="navbar-language-selector__toggler__arrow"></span>
|
||||||
|
<span className="hidden--accessible">Choose language</span>
|
||||||
</button>
|
</button>
|
||||||
<ul className="is-collapsed" data-collapsable="language-menu">
|
<ul className="is-collapsed" data-collapsable="language-menu">
|
||||||
{links.map(link => (
|
{links.map((link) => (
|
||||||
<li
|
<li
|
||||||
className={`navbar-language-selector__item ${currentLanguage === link.title ? 'is-active' : ''}`}
|
className={`navbar-language-selector__item ${currentLanguage === link.title ? "is-active" : ""}`}
|
||||||
key={link.href}
|
key={link.href}
|
||||||
>
|
>
|
||||||
<a href={link.href}>{link.title}</a>
|
<a href={link.href}>{link.title}</a>
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -21,77 +25,173 @@ export default function NoHeader({ pathname }: HeaderProps) {
|
|||||||
<header className="header" role="banner">
|
<header className="header" role="banner">
|
||||||
<div className="offline-banner hidden">
|
<div className="offline-banner hidden">
|
||||||
Du er offline. Noe innhold kan være utdatert.
|
Du er offline. Noe innhold kan være utdatert.
|
||||||
<button type="button" className="reload">Last inn på nytt</button>
|
<button type="button" className="reload">
|
||||||
|
Last inn på nytt
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="l-section main-header navigation-bar" data-js="main-nav-bar">
|
<div
|
||||||
|
className="l-section main-header navigation-bar"
|
||||||
|
data-js="main-nav-bar"
|
||||||
|
>
|
||||||
<div className="navigation-bar__top navigation-bar__top--ghostwhite-light">
|
<div className="navigation-bar__top navigation-bar__top--ghostwhite-light">
|
||||||
<div className="l-section__inner">
|
<div className="l-section__inner">
|
||||||
<a href="https://www.scandichotels.no" className="scandic-main-page-link">Tilbake til scandichotels.no</a>
|
<a
|
||||||
|
href="https://www.scandichotels.no"
|
||||||
|
className="scandic-main-page-link"
|
||||||
|
>
|
||||||
|
Tilbake til scandichotels.no
|
||||||
|
</a>
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.no/hotelreservation/get-booking">Vis/Avbestill din booking</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.no/hotelreservation/get-booking"
|
||||||
|
>
|
||||||
|
Vis/Avbestill din booking
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.no/jobb-hos-oss/ledige-stillinger">Jobb hos oss</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.no/jobb-hos-oss/ledige-stillinger"
|
||||||
|
>
|
||||||
|
Jobb hos oss
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.no/for-bedrifter">For bedrifter</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.no/for-bedrifter"
|
||||||
|
>
|
||||||
|
For bedrifter
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className=" hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a className="nav-secondary__item__link" href="https://www.scandichotels.no/scandic-friends">Om Scandic Friends</a>
|
<a
|
||||||
|
className="nav-secondary__item__link"
|
||||||
|
href="https://www.scandichotels.no/scandic-friends"
|
||||||
|
>
|
||||||
|
Om Scandic Friends
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="navigation-bar__main">
|
<div className="navigation-bar__main">
|
||||||
<div className="l-section__inner l-section__inner--small-no-padding" itemScope={undefined} itemType="http://schema.org/Organization">
|
<div
|
||||||
|
className="l-section__inner l-section__inner--small-no-padding"
|
||||||
|
itemScope={undefined}
|
||||||
|
itemType="http://schema.org/Organization"
|
||||||
|
>
|
||||||
<meta itemProp="name" content="Scandic" />
|
<meta itemProp="name" content="Scandic" />
|
||||||
<button type="button" className="navigation-bar__main__expander" data-js="main-nav-toggler" data-target="#main-menu" aria-pressed="false">
|
<button
|
||||||
<span className="icon-bars"></span><span className="hidden--accessible">Menu</span>
|
type="button"
|
||||||
|
className="navigation-bar__main__expander"
|
||||||
|
data-js="main-nav-toggler"
|
||||||
|
data-target="#main-menu"
|
||||||
|
aria-pressed="false"
|
||||||
|
>
|
||||||
|
<span className="icon-bars"></span>
|
||||||
|
<span className="hidden--accessible">Menu</span>
|
||||||
</button>
|
</button>
|
||||||
<a id="scandic-logo" className="navigation-bar__main__logo hidden-medium " href="https://www.scandichotels.no" itemProp="url">
|
<a
|
||||||
<span className="hidden--accessible">Tilbake til scandichotels.no</span>
|
id="scandic-logo"
|
||||||
<img src="/Static/img/scandic-logotype.svg" data-js="scandiclogoimg" alt="Scandic Hotels logo" height="22" data-nosvgsrc="/Static/img/scandic-logotype.png" itemProp="logo" />
|
className="navigation-bar__main__logo hidden-medium "
|
||||||
|
href="https://www.scandichotels.no"
|
||||||
|
itemProp="url"
|
||||||
|
>
|
||||||
|
<span className="hidden--accessible">
|
||||||
|
Tilbake til scandichotels.no
|
||||||
|
</span>
|
||||||
|
<img
|
||||||
|
src="/Static/img/scandic-logotype.svg"
|
||||||
|
data-js="scandiclogoimg"
|
||||||
|
alt="Scandic Hotels logo"
|
||||||
|
height="22"
|
||||||
|
data-nosvgsrc="/Static/img/scandic-logotype.png"
|
||||||
|
itemProp="logo"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<ul id="navbar-header-design" className="hidden hidden-medium hidden-large nav-primary__header">
|
<ul
|
||||||
|
id="navbar-header-design"
|
||||||
|
className="hidden hidden-medium hidden-large nav-primary__header"
|
||||||
|
>
|
||||||
<li className="nav-primary__scandicfriendslogo">
|
<li className="nav-primary__scandicfriendslogo">
|
||||||
<img src="/Static/img/icons/scandic-friends/icon-scandic-friends.svg" width="35" height="35" />
|
<img
|
||||||
|
src="/Static/img/icons/scandic-friends/icon-scandic-friends.svg"
|
||||||
|
width="35"
|
||||||
|
height="35"
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<nav>
|
<nav>
|
||||||
<ul id="main-menu" className="nav-primary is-collapsed" data-collapsable="main-menu">
|
<ul
|
||||||
<li className="nav-primary__item nav-primary__item--primary hidden-large hidden-small hidden-xsmall hidden-xxsmall" aria-hidden="true">
|
id="main-menu"
|
||||||
<a className="navigation-bar__main__logo" href="https://www.scandichotels.no">
|
className="nav-primary is-collapsed"
|
||||||
<img src="/Static/img/scandic-logotype.svg" data-js="scandiclogoimg" alt="Scandic Hotels logo" height="22" data-nosvgsrc="/Static/img/scandic-logotype.png" />
|
data-collapsable="main-menu"
|
||||||
<span className="hidden--accessible">Tilbake til scandichotels.no</span>
|
>
|
||||||
|
<li
|
||||||
|
className="nav-primary__item nav-primary__item--primary hidden-large hidden-small hidden-xsmall hidden-xxsmall"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="navigation-bar__main__logo"
|
||||||
|
href="https://www.scandichotels.no"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/Static/img/scandic-logotype.svg"
|
||||||
|
data-js="scandiclogoimg"
|
||||||
|
alt="Scandic Hotels logo"
|
||||||
|
height="22"
|
||||||
|
data-nosvgsrc="/Static/img/scandic-logotype.png"
|
||||||
|
/>
|
||||||
|
<span className="hidden--accessible">
|
||||||
|
Tilbake til scandichotels.no
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.no/hotell">Hoteller og destinasjoner</a>
|
<a href="https://www.scandichotels.no/hotell">
|
||||||
|
Hoteller og destinasjoner
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.no/reiseguider">Reiseguider</a>
|
<a href="https://www.scandichotels.no/reiseguider">
|
||||||
|
Reiseguider
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.no/moter-og-konferanser">Møter og konferanser</a>
|
<a href="https://www.scandichotels.no/moter-og-konferanser">
|
||||||
|
Møter og konferanser
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.no/utforsk-scandic">Utforsk Scandic</a>
|
<a href="https://www.scandichotels.no/utforsk-scandic">
|
||||||
|
Utforsk Scandic
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--primary ">
|
<li className="nav-primary__item nav-primary__item--primary ">
|
||||||
<a href="https://www.scandichotels.no/hotelltilbud">Tilbud</a>
|
<a href="https://www.scandichotels.no/hotelltilbud">Tilbud</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
||||||
<a href="https://www.scandichotels.no/scandic-friends">Om Scandic Friends</a>
|
<a href="https://www.scandichotels.no/scandic-friends">
|
||||||
|
Om Scandic Friends
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
<li className="nav-primary__item nav-primary__item--secondary hidden-medium hidden-large ">
|
||||||
<a href="https://www.scandichotels.no/for-bedrifter">For bedrifter</a>
|
<a href="https://www.scandichotels.no/for-bedrifter">
|
||||||
|
For bedrifter
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
/* eslint-disable @next/next/no-img-element */
|
/* eslint-disable @next/next/no-img-element */
|
||||||
import { currentAboutLinks, currentSponsoringLinks, currentWifiLinks } from "@/constants/current/links"
|
import {
|
||||||
|
currentAboutLinks,
|
||||||
|
currentSponsoringLinks,
|
||||||
|
currentWifiLinks,
|
||||||
|
} from "@/constants/current/links"
|
||||||
|
|
||||||
import Desktop from "./LanguageSwitcher/Desktop"
|
import Desktop from "./LanguageSwitcher/Desktop"
|
||||||
import Mobile from "./LanguageSwitcher/Mobile"
|
import Mobile from "./LanguageSwitcher/Mobile"
|
||||||
@@ -40,7 +44,9 @@ export default function SvHeader({ pathname }: HeaderProps) {
|
|||||||
|
|
||||||
<ul className="nav-secondary navbar-login">
|
<ul className="nav-secondary navbar-login">
|
||||||
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
<li className="nav-secondary__item hidden-xxsmall hidden-xsmall hidden-small">
|
||||||
{links ? <Desktop currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Desktop currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
<li className="hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
<li className="hidden-xxsmall hidden-xsmall hidden-small nav-secondary__item">
|
||||||
<a
|
<a
|
||||||
@@ -178,7 +184,9 @@ export default function SvHeader({ pathname }: HeaderProps) {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li className="nav-primary__item hidden-medium hidden-large">
|
<li className="nav-primary__item hidden-medium hidden-large">
|
||||||
{links ? <Mobile currentLanguage={currentLanguage} links={links} /> : null}
|
{links ? (
|
||||||
|
<Mobile currentLanguage={currentLanguage} links={links} />
|
||||||
|
) : null}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -186,5 +194,5 @@ export default function SvHeader({ pathname }: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
import { langEnum } from "@/types/lang";
|
import { langEnum } from "@/types/lang"
|
||||||
|
|
||||||
import Da from "./Da";
|
import Da from "./Da"
|
||||||
import De from "./De";
|
import De from "./De"
|
||||||
import En from "./En";
|
import En from "./En"
|
||||||
import Fi from "./Fi";
|
import Fi from "./Fi"
|
||||||
import No from "./No";
|
import No from "./No"
|
||||||
import Sv from "./Sv";
|
import Sv from "./Sv"
|
||||||
|
|
||||||
import type { HeaderProps } from "@/types/components/current/header";
|
import type { HeaderProps } from "@/types/components/current/header"
|
||||||
import { LangParams } from "@/types/params";
|
import { LangParams } from "@/types/params"
|
||||||
|
|
||||||
export default function Header({ lang, pathname }: LangParams & HeaderProps) {
|
export default function Header({ lang, pathname }: LangParams & HeaderProps) {
|
||||||
switch (lang) {
|
switch (lang) {
|
||||||
case langEnum.sv:
|
case langEnum.sv:
|
||||||
return <Sv pathname={pathname} />;
|
return <Sv pathname={pathname} />
|
||||||
case langEnum.fi:
|
case langEnum.fi:
|
||||||
return <Fi pathname={pathname} />;
|
return <Fi pathname={pathname} />
|
||||||
case langEnum.en:
|
case langEnum.en:
|
||||||
return <En pathname={pathname} />;
|
return <En pathname={pathname} />
|
||||||
case langEnum.da:
|
case langEnum.da:
|
||||||
return <Da pathname={pathname} />;
|
return <Da pathname={pathname} />
|
||||||
case langEnum.de:
|
case langEnum.de:
|
||||||
return <De pathname={pathname} />;
|
return <De pathname={pathname} />
|
||||||
case langEnum.no:
|
case langEnum.no:
|
||||||
return <No pathname={pathname} />;
|
return <No pathname={pathname} />
|
||||||
default:
|
default:
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +1,48 @@
|
|||||||
import { localeToLang } from "@/constants/locales";
|
import { localeToLang } from "@/constants/locales"
|
||||||
import { type Lang, langEnum } from "@/types/lang";
|
import { type Lang, langEnum } from "@/types/lang"
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers"
|
||||||
|
|
||||||
export default function LangPopup({ lang }: { lang: Lang }) {
|
export default function LangPopup({ lang }: { lang: Lang }) {
|
||||||
const headersList = headers();
|
const headersList = headers()
|
||||||
const preferedLang = headersList.get("Accept-Language") ?? "";
|
const preferedLang = headersList.get("Accept-Language") ?? ""
|
||||||
|
|
||||||
const possibleLocales = Object.keys(localeToLang);
|
const possibleLocales = Object.keys(localeToLang)
|
||||||
|
|
||||||
if (!possibleLocales.includes(preferedLang)) {
|
if (!possibleLocales.includes(preferedLang)) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const langOfChoice: Lang = localeToLang[preferedLang];
|
const langOfChoice: Lang = localeToLang[preferedLang]
|
||||||
|
|
||||||
if (langOfChoice === lang) {
|
if (langOfChoice === lang) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
let language = "";
|
let language = ""
|
||||||
let viewIn = "";
|
let viewIn = ""
|
||||||
|
|
||||||
switch (langOfChoice) {
|
switch (langOfChoice) {
|
||||||
case langEnum.de:
|
case langEnum.de:
|
||||||
language = "Deutsch";
|
language = "Deutsch"
|
||||||
viewIn = "Ansicht in";
|
viewIn = "Ansicht in"
|
||||||
break;
|
break
|
||||||
case langEnum.da:
|
case langEnum.da:
|
||||||
language = "Dansk";
|
language = "Dansk"
|
||||||
viewIn = "Se in";
|
viewIn = "Se in"
|
||||||
break;
|
break
|
||||||
case langEnum.fi:
|
case langEnum.fi:
|
||||||
language = "Suomi";
|
language = "Suomi"
|
||||||
viewIn = "Katso in";
|
viewIn = "Katso in"
|
||||||
break;
|
break
|
||||||
case langEnum.no:
|
case langEnum.no:
|
||||||
language = "Norsk";
|
language = "Norsk"
|
||||||
viewIn = "Se in";
|
viewIn = "Se in"
|
||||||
break;
|
break
|
||||||
case langEnum.sv:
|
case langEnum.sv:
|
||||||
language = "Svenska";
|
language = "Svenska"
|
||||||
viewIn = "Visa in";
|
viewIn = "Visa in"
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -89,5 +89,5 @@ export default function LangPopup({ lang }: { lang: Lang }) {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"use client";
|
"use client"
|
||||||
|
|
||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import ContentstackLivePreview from "@contentstack/live-preview-utils"
|
import ContentstackLivePreview from "@contentstack/live-preview-utils"
|
||||||
@@ -8,7 +8,7 @@ export default function InitLivePreview() {
|
|||||||
if (!ContentstackLivePreview.livePreview) {
|
if (!ContentstackLivePreview.livePreview) {
|
||||||
ContentstackLivePreview.init()
|
ContentstackLivePreview.init()
|
||||||
}
|
}
|
||||||
}, []);
|
}, [])
|
||||||
|
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@
|
|||||||
animation-delay: 0s;
|
animation-delay: 0s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes spinnerAnimation {
|
@keyframes spinnerAnimation {
|
||||||
0% {
|
0% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
.currentPage,
|
.currentPage,
|
||||||
.li {
|
.li {
|
||||||
font-size: .875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.4em;
|
line-height: 1.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (min-width: 740px) {
|
@media (min-width: 740px) {
|
||||||
.nav {
|
.nav {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import styles from "./breadcrumbs.module.css"
|
|||||||
|
|
||||||
import type { BreadcrumbsProps } from "@/types/components/current/breadcrumbs"
|
import type { BreadcrumbsProps } from "@/types/components/current/breadcrumbs"
|
||||||
|
|
||||||
export default function Breadcrumbs({ breadcrumbs, parent, title }: BreadcrumbsProps) {
|
export default function Breadcrumbs({
|
||||||
|
breadcrumbs,
|
||||||
|
parent,
|
||||||
|
title,
|
||||||
|
}: BreadcrumbsProps) {
|
||||||
return (
|
return (
|
||||||
<nav className={styles.nav}>
|
<nav className={styles.nav}>
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
|
|||||||
@@ -7,11 +7,21 @@ import styles from "./preamble.module.css"
|
|||||||
|
|
||||||
import type { PreambleProps } from "@/types/components/current/preamble"
|
import type { PreambleProps } from "@/types/components/current/preamble"
|
||||||
|
|
||||||
export default function Preamble({ breadcrumbs, breadcrumbParent, breadcrumbTitle, preamble, title }: PreambleProps) {
|
export default function Preamble({
|
||||||
|
breadcrumbs,
|
||||||
|
breadcrumbParent,
|
||||||
|
breadcrumbTitle,
|
||||||
|
preamble,
|
||||||
|
title,
|
||||||
|
}: PreambleProps) {
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<section>
|
<section>
|
||||||
<Breadcrumbs breadcrumbs={breadcrumbs} parent={breadcrumbParent} title={breadcrumbTitle} />
|
<Breadcrumbs
|
||||||
|
breadcrumbs={breadcrumbs}
|
||||||
|
parent={breadcrumbParent}
|
||||||
|
title={breadcrumbTitle}
|
||||||
|
/>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
{preamble?.text ? (
|
{preamble?.text ? (
|
||||||
<JsonToHtml
|
<JsonToHtml
|
||||||
|
|||||||
@@ -9,7 +9,12 @@
|
|||||||
|
|
||||||
.preamble {
|
.preamble {
|
||||||
color: #333;
|
color: #333;
|
||||||
font-family: Helvetica Neue, Roboto, Helvetica, Arial, sans-serif;
|
font-family:
|
||||||
|
Helvetica Neue,
|
||||||
|
Roboto,
|
||||||
|
Helvetica,
|
||||||
|
Arial,
|
||||||
|
sans-serif;
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import type { RTENext, RTEDefaultNode } from "@/types/rte/node"
|
|||||||
import type { RenderOptions } from "@/types/rte/option"
|
import type { RenderOptions } from "@/types/rte/option"
|
||||||
|
|
||||||
export const renderOptions: RenderOptions = {
|
export const renderOptions: RenderOptions = {
|
||||||
[RTETypeEnum.p]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.p]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<p key={node.uid} className={styles.preamble}>
|
<p key={node.uid} className={styles.preamble}>
|
||||||
{next(node.children, embeds, fullRenderOptions)}
|
{next(node.children, embeds, fullRenderOptions)}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import styles from "./section.module.css"
|
|||||||
export default function Section({ children }: React.PropsWithChildren) {
|
export default function Section({ children }: React.PropsWithChildren) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<section className={styles.section}>
|
<section className={styles.section}>{children}</section>
|
||||||
{children}
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.section {
|
.section {
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import Link from "next/link"
|
|||||||
|
|
||||||
import type { SubnavMobileProps } from "@/types/components/current/subnavMobile"
|
import type { SubnavMobileProps } from "@/types/components/current/subnavMobile"
|
||||||
|
|
||||||
export default async function SubnavMobile({ breadcrumbs, parent, title }: SubnavMobileProps) {
|
export default async function SubnavMobile({
|
||||||
|
breadcrumbs,
|
||||||
|
parent,
|
||||||
|
title,
|
||||||
|
}: SubnavMobileProps) {
|
||||||
return (
|
return (
|
||||||
<div className="subnav-mobile hidden-small hidden-medium hidden-large">
|
<div className="subnav-mobile hidden-small hidden-medium hidden-large">
|
||||||
<nav className="u-flex">
|
<nav className="u-flex">
|
||||||
@@ -14,7 +18,7 @@ export default async function SubnavMobile({ breadcrumbs, parent, title }: Subna
|
|||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
) : null}
|
) : null}
|
||||||
{breadcrumbs.edges.map(breadcrumb => (
|
{breadcrumbs.edges.map((breadcrumb) => (
|
||||||
<li className="breadcrumb-list__body" key={breadcrumb.node.url}>
|
<li className="breadcrumb-list__body" key={breadcrumb.node.url}>
|
||||||
<Link href={breadcrumb.node.url}>
|
<Link href={breadcrumb.node.url}>
|
||||||
{breadcrumb.node.breadcrumbs?.title ?? breadcrumb.node.title}
|
{breadcrumb.node.breadcrumbs?.title ?? breadcrumb.node.title}
|
||||||
|
|||||||
@@ -8,10 +8,5 @@ function imageLoader({ quality, src, width }: ImageLoaderProps) {
|
|||||||
|
|
||||||
// Next/Image adds & instead of ? before the params
|
// Next/Image adds & instead of ? before the params
|
||||||
export default function Image(props: ImageProps) {
|
export default function Image(props: ImageProps) {
|
||||||
return (
|
return <NextImage {...props} loader={imageLoader} />
|
||||||
<NextImage
|
|
||||||
{...props}
|
|
||||||
loader={imageLoader}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import { nodesToHtml } from "./utils"
|
|||||||
|
|
||||||
import type { JsonToHtmlProps } from "@/types/components/jsontohtml"
|
import type { JsonToHtmlProps } from "@/types/components/jsontohtml"
|
||||||
|
|
||||||
export default function JsonToHtml({ embeds, nodes, renderOptions = {} }: JsonToHtmlProps) {
|
export default function JsonToHtml({
|
||||||
|
embeds,
|
||||||
|
nodes,
|
||||||
|
renderOptions = {},
|
||||||
|
}: JsonToHtmlProps) {
|
||||||
if (!Array.isArray(nodes) || !nodes.length) {
|
if (!Array.isArray(nodes) || !nodes.length) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ import styles from "./jsontohtml.module.css"
|
|||||||
|
|
||||||
import type { Attributes } from "@/types/rte/attrs"
|
import type { Attributes } from "@/types/rte/attrs"
|
||||||
import type { EmbedByUid } from "@/types/components/jsontohtml"
|
import type { EmbedByUid } from "@/types/components/jsontohtml"
|
||||||
import type { RTENext, RTEDefaultNode, RTENode, RTERegularNode } from "@/types/rte/node"
|
import type {
|
||||||
|
RTENext,
|
||||||
|
RTEDefaultNode,
|
||||||
|
RTENode,
|
||||||
|
RTERegularNode,
|
||||||
|
} from "@/types/rte/node"
|
||||||
import type { RenderOptions } from "@/types/rte/option"
|
import type { RenderOptions } from "@/types/rte/option"
|
||||||
|
|
||||||
function extractPossibleAttributes(attrs: Attributes) {
|
function extractPossibleAttributes(attrs: Attributes) {
|
||||||
@@ -30,7 +35,12 @@ function extractPossibleAttributes(attrs: Attributes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const renderOptions: RenderOptions = {
|
export const renderOptions: RenderOptions = {
|
||||||
[RTETypeEnum.a]: (node: RTERegularNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.a]: (
|
||||||
|
node: RTERegularNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
if (node.attrs.url) {
|
if (node.attrs.url) {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
@@ -47,7 +57,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.blockquote]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.blockquote]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<blockquote key={node.uid} {...props}>
|
<blockquote key={node.uid} {...props}>
|
||||||
@@ -56,7 +71,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.code]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.code]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<code key={node.uid} {...props}>
|
<code key={node.uid} {...props}>
|
||||||
@@ -65,7 +85,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.embed]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.embed]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
if (node.attrs.src) {
|
if (node.attrs.src) {
|
||||||
props.src = node.attrs.src
|
props.src = node.attrs.src
|
||||||
@@ -83,7 +108,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h1]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h1]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h1 key={node.uid} {...props}>
|
<h1 key={node.uid} {...props}>
|
||||||
@@ -92,7 +122,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h2]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h2]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h2 key={node.uid} {...props}>
|
<h2 key={node.uid} {...props}>
|
||||||
@@ -101,7 +136,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h3]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h3]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h3 key={node.uid} {...props}>
|
<h3 key={node.uid} {...props}>
|
||||||
@@ -110,7 +150,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h4]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h4]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h4 key={node.uid} {...props}>
|
<h4 key={node.uid} {...props}>
|
||||||
@@ -119,7 +164,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h5]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h5]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h5 key={node.uid} {...props}>
|
<h5 key={node.uid} {...props}>
|
||||||
@@ -128,7 +178,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.h6]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.h6]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<h6 key={node.uid} {...props}>
|
<h6 key={node.uid} {...props}>
|
||||||
@@ -141,7 +196,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
return <hr />
|
return <hr />
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.li]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.li]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<li key={node.uid} {...props}>
|
<li key={node.uid} {...props}>
|
||||||
@@ -150,7 +210,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.ol]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.ol]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<ol key={node.uid} {...props}>
|
<ol key={node.uid} {...props}>
|
||||||
@@ -159,7 +224,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.p]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.p]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<p {...props} key={node.uid}>
|
<p {...props} key={node.uid}>
|
||||||
@@ -168,7 +238,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.reference]: (node: RTENode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.reference]: (
|
||||||
|
node: RTENode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
if ("attrs" in node) {
|
if ("attrs" in node) {
|
||||||
const type = node.attrs.type
|
const type = node.attrs.type
|
||||||
if (type === RTEItemTypeEnum.asset) {
|
if (type === RTEItemTypeEnum.asset) {
|
||||||
@@ -199,7 +274,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.table]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.table]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<table key={node.uid} {...props}>
|
<table key={node.uid} {...props}>
|
||||||
@@ -208,7 +288,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.thead]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.thead]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<thead key={node.uid} {...props}>
|
<thead key={node.uid} {...props}>
|
||||||
@@ -217,7 +302,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.tbody]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.tbody]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<tbody key={node.uid} {...props}>
|
<tbody key={node.uid} {...props}>
|
||||||
@@ -226,7 +316,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.tfoot]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.tfoot]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<tfoot key={node.uid} {...props}>
|
<tfoot key={node.uid} {...props}>
|
||||||
@@ -235,7 +330,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.tr]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.tr]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<tr key={node.uid} {...props}>
|
<tr key={node.uid} {...props}>
|
||||||
@@ -244,7 +344,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.th]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.th]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<th key={node.uid} {...props}>
|
<th key={node.uid} {...props}>
|
||||||
@@ -253,7 +358,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.td]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.td]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<td key={node.uid} {...props}>
|
<td key={node.uid} {...props}>
|
||||||
@@ -262,7 +372,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTETypeEnum.ul]: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
[RTETypeEnum.ul]: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
const props = extractPossibleAttributes(node.attrs)
|
const props = extractPossibleAttributes(node.attrs)
|
||||||
return (
|
return (
|
||||||
<ul key={node.uid} {...props}>
|
<ul key={node.uid} {...props}>
|
||||||
@@ -309,7 +424,11 @@ export const renderOptions: RenderOptions = {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
[RTEMarkType.classnameOrId]: (children: React.ReactNode, className?: string, id?: string) => {
|
[RTEMarkType.classnameOrId]: (
|
||||||
|
children: React.ReactNode,
|
||||||
|
className?: string,
|
||||||
|
id?: string
|
||||||
|
) => {
|
||||||
let props = {
|
let props = {
|
||||||
className,
|
className,
|
||||||
id,
|
id,
|
||||||
@@ -331,7 +450,12 @@ export const renderOptions: RenderOptions = {
|
|||||||
* Contentstack can return something called `default` as seen here in their
|
* Contentstack can return something called `default` as seen here in their
|
||||||
* own SDK (https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/options/default-node-options.ts#L89)
|
* own SDK (https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/options/default-node-options.ts#L89)
|
||||||
*/
|
*/
|
||||||
default: (node: RTEDefaultNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => {
|
default: (
|
||||||
|
node: RTEDefaultNode,
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => {
|
||||||
return next(node.children, embeds, fullRenderOptions)
|
return next(node.children, embeds, fullRenderOptions)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import { RTETypeEnum } from "@/types/rte/enums"
|
|||||||
import type { EmbedByUid } from "@/types/components/jsontohtml"
|
import type { EmbedByUid } from "@/types/components/jsontohtml"
|
||||||
import type { Node } from "@/types/requests/utils/edges"
|
import type { Node } from "@/types/requests/utils/edges"
|
||||||
import type { RenderOptions } from "@/types/rte/option"
|
import type { RenderOptions } from "@/types/rte/option"
|
||||||
import type { RTENode, RTETextNode, RTERenderOptionComponent } from "@/types/rte/node"
|
import type {
|
||||||
|
RTENode,
|
||||||
|
RTETextNode,
|
||||||
|
RTERenderOptionComponent,
|
||||||
|
} from "@/types/rte/node"
|
||||||
import type { Embeds } from "@/types/requests/embeds"
|
import type { Embeds } from "@/types/requests/embeds"
|
||||||
|
|
||||||
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
||||||
const embedsByUid = embedsArray
|
const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => {
|
||||||
.reduce<EmbedByUid>((acc, embed) => {
|
|
||||||
if (embed.node.system.uid) {
|
if (embed.node.system.uid) {
|
||||||
acc[embed.node.system.uid] = embed
|
acc[embed.node.system.uid] = embed
|
||||||
}
|
}
|
||||||
@@ -21,7 +24,6 @@ export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
|||||||
return embedsByUid
|
return embedsByUid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function nodeChildrenToHtml(
|
export function nodeChildrenToHtml(
|
||||||
nodes: RTENode[],
|
nodes: RTENode[],
|
||||||
embeds: EmbedByUid,
|
embeds: EmbedByUid,
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
import { Lang, langEnum } from "@/types/lang";
|
import { Lang, langEnum } from "@/types/lang"
|
||||||
|
|
||||||
export default function SkipToMainContent({ lang }: { lang: Lang }) {
|
export default function SkipToMainContent({ lang }: { lang: Lang }) {
|
||||||
let message = "Skip to main content";
|
let message = "Skip to main content"
|
||||||
|
|
||||||
switch (lang) {
|
switch (lang) {
|
||||||
case langEnum.de:
|
case langEnum.de:
|
||||||
message = "Direkt zum Inhalt";
|
message = "Direkt zum Inhalt"
|
||||||
break;
|
break
|
||||||
case langEnum.sv:
|
case langEnum.sv:
|
||||||
message = "Fortsätt till huvudinnehåll";
|
message = "Fortsätt till huvudinnehåll"
|
||||||
break;
|
break
|
||||||
case langEnum.da:
|
case langEnum.da:
|
||||||
message = "Spring over og gå til hovedindhold";
|
message = "Spring over og gå til hovedindhold"
|
||||||
break;
|
break
|
||||||
case langEnum.no:
|
case langEnum.no:
|
||||||
message = "Gå videre til hovedsiden";
|
message = "Gå videre til hovedsiden"
|
||||||
break;
|
break
|
||||||
case langEnum.fi:
|
case langEnum.fi:
|
||||||
message = "Siirry pääsisältöön";
|
message = "Siirry pääsisältöön"
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -27,5 +27,5 @@ export default function SkipToMainContent({ lang }: { lang: Lang }) {
|
|||||||
{message}
|
{message}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { langEnum } from "@/types/lang";
|
import { langEnum } from "@/types/lang"
|
||||||
|
|
||||||
export const localeToLang = {
|
export const localeToLang = {
|
||||||
en: langEnum.en,
|
en: langEnum.en,
|
||||||
@@ -38,4 +38,4 @@ export const localeToLang = {
|
|||||||
"nb-NO": langEnum.no,
|
"nb-NO": langEnum.no,
|
||||||
"nn-NO": langEnum.no,
|
"nn-NO": langEnum.no,
|
||||||
"se-NO": langEnum.no,
|
"se-NO": langEnum.no,
|
||||||
};
|
}
|
||||||
|
|||||||
2
env/client.ts
vendored
2
env/client.ts
vendored
@@ -5,4 +5,4 @@ export const env = createEnv({
|
|||||||
client: {},
|
client: {},
|
||||||
emptyStringAsUndefined: true,
|
emptyStringAsUndefined: true,
|
||||||
runtimeEnv: {},
|
runtimeEnv: {},
|
||||||
});
|
})
|
||||||
|
|||||||
4
env/server.ts
vendored
4
env/server.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import { createEnv } from "@t3-oss/env-nextjs"
|
import { createEnv } from "@t3-oss/env-nextjs"
|
||||||
import { z } from "zod";
|
import { z } from "zod"
|
||||||
|
|
||||||
export const env = createEnv({
|
export const env = createEnv({
|
||||||
server: {
|
server: {
|
||||||
@@ -23,4 +23,4 @@ export const env = createEnv({
|
|||||||
NODE_ENV: process.env.NODE_ENV,
|
NODE_ENV: process.env.NODE_ENV,
|
||||||
PRINT_QUERY: process.env.PRINT_QUERY,
|
PRINT_QUERY: process.env.PRINT_QUERY,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import "server-only";
|
import "server-only"
|
||||||
import { request as graphqlRequest } from "graphql-request";
|
import { request as graphqlRequest } from "graphql-request"
|
||||||
|
|
||||||
import { env } from "@/env/server";
|
import { env } from "@/env/server"
|
||||||
|
|
||||||
import type { Data } from "@/types/request";
|
import type { Data } from "@/types/request"
|
||||||
import type { DocumentNode } from "graphql";
|
import type { DocumentNode } from "graphql"
|
||||||
import ContentstackLivePreview from "@contentstack/live-preview-utils";
|
import ContentstackLivePreview from "@contentstack/live-preview-utils"
|
||||||
|
|
||||||
export async function previewRequest<T>(
|
export async function previewRequest<T>(
|
||||||
query: string | DocumentNode,
|
query: string | DocumentNode,
|
||||||
@@ -33,7 +33,7 @@ export async function previewRequest<T>(
|
|||||||
|
|
||||||
return { data: response }
|
return { data: response }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error)
|
||||||
throw new Error("Something went wrong");
|
throw new Error("Something went wrong")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import { env } from "@/env/server"
|
|||||||
import type { Data } from "@/types/request"
|
import type { Data } from "@/types/request"
|
||||||
import type { DocumentNode } from "graphql"
|
import type { DocumentNode } from "graphql"
|
||||||
|
|
||||||
export async function request<T>(query: string | DocumentNode, variables?: {}): Promise<Data<T>> {
|
export async function request<T>(
|
||||||
|
query: string | DocumentNode,
|
||||||
|
variables?: {}
|
||||||
|
): Promise<Data<T>> {
|
||||||
try {
|
try {
|
||||||
if (env.PRINT_QUERY) {
|
if (env.PRINT_QUERY) {
|
||||||
const graphqlRawRequest = (await import("graphql-request")).rawRequest
|
const graphqlRawRequest = (await import("graphql-request")).rawRequest
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import ContentstackLivePreview from "@contentstack/live-preview-utils";
|
import ContentstackLivePreview from "@contentstack/live-preview-utils"
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server"
|
||||||
import type { NextRequest } from "next/server";
|
import type { NextRequest } from "next/server"
|
||||||
|
|
||||||
// This function can be marked `async` if using `await` inside
|
// This function can be marked `async` if using `await` inside
|
||||||
export async function middleware(request: NextRequest) {
|
export async function middleware(request: NextRequest) {
|
||||||
@@ -69,4 +69,4 @@ export const config = {
|
|||||||
*/
|
*/
|
||||||
"/((?!api|_next/static|_next/image|Static|imageVault|contentassets|favicon.ico).*)",
|
"/((?!api|_next/static|_next/image|Static|imageVault|contentassets|favicon.ico).*)",
|
||||||
],
|
],
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import createJiti from "jiti"
|
import createJiti from "jiti"
|
||||||
|
|
||||||
const jiti = createJiti(new URL(import.meta.url).pathname);
|
const jiti = createJiti(new URL(import.meta.url).pathname)
|
||||||
|
|
||||||
jiti("./env/server");
|
jiti("./env/server")
|
||||||
jiti("./env/client");
|
jiti("./env/client")
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
@@ -22,11 +22,11 @@ const nextConfig = {
|
|||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.(graphql|gql)/,
|
test: /\.(graphql|gql)/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: "graphql-tag/loader"
|
loader: "graphql-tag/loader",
|
||||||
});
|
})
|
||||||
|
|
||||||
return config;
|
return config
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
export default nextConfig
|
export default nextConfig
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "ES2022"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"ES2022"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
@@ -25,18 +21,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".next/types/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export type HeaderProps = {
|
export type HeaderProps = {
|
||||||
pathname: string;
|
pathname: string
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { RTENode } from "../rte/node"
|
import type { RTENode } from "../rte/node"
|
||||||
|
|
||||||
import type { Node } from "@/types/requests/utils/edges";
|
import type { Node } from "@/types/requests/utils/edges"
|
||||||
import type { RenderOptions } from "../rte/option";
|
import type { RenderOptions } from "../rte/option"
|
||||||
import type { Embeds } from "@/types/requests/embeds";
|
import type { Embeds } from "@/types/requests/embeds"
|
||||||
|
|
||||||
export type JsonToHtmlProps = {
|
export type JsonToHtmlProps = {
|
||||||
embeds: Node<Embeds>[]
|
embeds: Node<Embeds>[]
|
||||||
|
|||||||
2
types/graphql.d.ts
vendored
2
types/graphql.d.ts
vendored
@@ -1 +1 @@
|
|||||||
declare module '*.graphql'
|
declare module "*.graphql"
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ export const langEnum = {
|
|||||||
fi: "fi",
|
fi: "fi",
|
||||||
da: "da",
|
da: "da",
|
||||||
de: "de",
|
de: "de",
|
||||||
};
|
}
|
||||||
|
|
||||||
export type Lang = keyof typeof langEnum;
|
export type Lang = keyof typeof langEnum
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
import { Lang } from './lang';
|
import { Lang } from "./lang"
|
||||||
|
|
||||||
export type SearchParams<S = {}> = {
|
export type SearchParams<S = {}> = {
|
||||||
searchParams: S & { [key: string]: string };
|
searchParams: S & { [key: string]: string }
|
||||||
};
|
}
|
||||||
|
|
||||||
export type Params<P = {}> = {
|
export type Params<P = {}> = {
|
||||||
params: P;
|
params: P
|
||||||
};
|
}
|
||||||
|
|
||||||
export type LangParams = {
|
export type LangParams = {
|
||||||
lang: Lang;
|
lang: Lang
|
||||||
};
|
}
|
||||||
|
|
||||||
export type UriParams = {
|
export type UriParams = {
|
||||||
uri?: string;
|
uri?: string
|
||||||
};
|
}
|
||||||
|
|
||||||
export type PreviewParams = {
|
export type PreviewParams = {
|
||||||
uri?: string
|
uri?: string
|
||||||
live_preview?: string
|
live_preview?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LayoutArgs<P = undefined> = P extends undefined ? {} : Params<P>;
|
export type LayoutArgs<P = undefined> = P extends undefined ? {} : Params<P>
|
||||||
|
|
||||||
export type PageArgs<P = undefined, S = undefined> = LayoutArgs<P> &
|
export type PageArgs<P = undefined, S = undefined> = LayoutArgs<P> &
|
||||||
(S extends undefined ? {} : SearchParams<S>);
|
(S extends undefined ? {} : SearchParams<S>)
|
||||||
|
|||||||
@@ -64,5 +64,4 @@ export type List = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type ListProps = List
|
export type ListProps = List
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export interface Attributes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface RTEAssetAttrs extends Attributes {
|
export interface RTEAssetAttrs extends Attributes {
|
||||||
"alt": string
|
alt: string
|
||||||
"asset-alt": string
|
"asset-alt": string
|
||||||
"asset-link": string
|
"asset-link": string
|
||||||
"asset-name": string
|
"asset-name": string
|
||||||
@@ -17,8 +17,8 @@ export interface RTEAssetAttrs extends Attributes {
|
|||||||
"asset-uid": string
|
"asset-uid": string
|
||||||
"display-type": EmbedTypesEnum.display
|
"display-type": EmbedTypesEnum.display
|
||||||
"content-type-uid": "sys_assets"
|
"content-type-uid": "sys_assets"
|
||||||
"inline": false
|
inline: false
|
||||||
"type": RTEItemTypeEnum.asset
|
type: RTEItemTypeEnum.asset
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RTEAnchorAttrs extends Attributes {
|
export interface RTEAnchorAttrs extends Attributes {
|
||||||
@@ -27,10 +27,10 @@ export interface RTEAnchorAttrs extends Attributes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface RTELinkAttrs extends Attributes {
|
export interface RTELinkAttrs extends Attributes {
|
||||||
'display-type': EmbedTypesEnum.link
|
"display-type": EmbedTypesEnum.link
|
||||||
'class-name': string
|
"class-name": string
|
||||||
'content-type-uid': string
|
"content-type-uid": string
|
||||||
'entry-uid': string
|
"entry-uid": string
|
||||||
locale: Lang
|
locale: Lang
|
||||||
href: string
|
href: string
|
||||||
target: HTMLAnchorElement["target"]
|
target: HTMLAnchorElement["target"]
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export enum EmbedTypesEnum {
|
export enum EmbedTypesEnum {
|
||||||
block = 'block',
|
block = "block",
|
||||||
display = 'display',
|
display = "display",
|
||||||
download = 'download',
|
download = "download",
|
||||||
inline = 'inline',
|
inline = "inline",
|
||||||
link = 'link',
|
link = "link",
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EmbedTypes = keyof typeof EmbedTypesEnum
|
export type EmbedTypes = keyof typeof EmbedTypesEnum
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { RTETypeEnum } from "./enums"
|
import { RTETypeEnum } from "./enums"
|
||||||
import type { Attributes, RTEAnchorAttrs, RTEAssetAttrs, RTELinkAttrs } from "./attrs"
|
import type {
|
||||||
|
Attributes,
|
||||||
|
RTEAnchorAttrs,
|
||||||
|
RTEAssetAttrs,
|
||||||
|
RTELinkAttrs,
|
||||||
|
} from "./attrs"
|
||||||
import type { EmbedByUid } from "../components/jsontohtml"
|
import type { EmbedByUid } from "../components/jsontohtml"
|
||||||
import type { RenderOptions } from "./option"
|
import type { RenderOptions } from "./option"
|
||||||
|
|
||||||
@@ -58,14 +63,26 @@ export type RTEReferenceNode = RTEDefaultNode | RTEAnchorNode
|
|||||||
|
|
||||||
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
|
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
|
||||||
|
|
||||||
export type RTERenderMark = (children: React.ReactNode, classname?: string, id?: string) => JSX.Element
|
export type RTERenderMark = (
|
||||||
|
children: React.ReactNode,
|
||||||
|
classname?: string,
|
||||||
|
id?: string
|
||||||
|
) => JSX.Element
|
||||||
|
|
||||||
export interface RTEDocument extends RTEDefaultNode {
|
export interface RTEDocument extends RTEDefaultNode {
|
||||||
type: RTETypeEnum.doc
|
type: RTETypeEnum.doc
|
||||||
_version: number
|
_version: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RTERenderOptionComponent = (node: RTERegularNode, embeds: EmbedByUid, next: RTENext, fullRenderOptions: RenderOptions) => React.ReactNode
|
export type RTERenderOptionComponent = (
|
||||||
|
node: RTERegularNode,
|
||||||
export type RTENext = (nodes: RTENode[], embeds: EmbedByUid, fullRenderOptions: RenderOptions) => string
|
embeds: EmbedByUid,
|
||||||
|
next: RTENext,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => React.ReactNode
|
||||||
|
|
||||||
|
export type RTENext = (
|
||||||
|
nodes: RTENode[],
|
||||||
|
embeds: EmbedByUid,
|
||||||
|
fullRenderOptions: RenderOptions
|
||||||
|
) => string
|
||||||
|
|||||||
Reference in New Issue
Block a user