Merged in chore/prettier-with-ignore (pull request #33)

Chore/prettier with ignore

Approved-by: Michael Zetterberg
This commit is contained in:
Arvid Norlin
2024-02-19 14:27:04 +00:00
committed by Michael Zetterberg
73 changed files with 852 additions and 444 deletions

6
.prettierignore Normal file
View File

@@ -0,0 +1,6 @@
# Directories
public/Static
# Files
app/core.css
app/scandic.css

View File

@@ -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,

View File

@@ -1,4 +1,3 @@
.highlightBlock { .highlightBlock {
padding: 10px 10px 15px; padding: 10px 10px 15px;
background: #fff; background: #fff;

View File

@@ -43,9 +43,9 @@
} }
@media screen and (min-width: 740px) { @media screen and (min-width: 740px) {
.content { .content {
padding: 20px 0px; padding: 20px 0px;
} }
} }
@media screen and (min-width: 950px) { @media screen and (min-width: 950px) {

View File

@@ -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)}

View File

@@ -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} />
))} ))}
</> </>

View File

@@ -1,3 +1,3 @@
.wrapper { .wrapper {
padding: 20px 10px 5px; padding: 20px 10px 5px;
} }

View File

@@ -1,65 +1,67 @@
.title { .title {
font-family: BrandonText-Bold,Arial,Helvetica,sans-serif; font-family: BrandonText-Bold, Arial, Helvetica, sans-serif;
font-size: 1.375rem; font-size: 1.375rem;
line-height: 1.1em; line-height: 1.1em;
text-transform: uppercase; text-transform: uppercase;
font-weight: 400; font-weight: 400;
color: #483729; color: #483729;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.ul { .ul {
margin-bottom: 15px; margin-bottom: 15px;
} }
.listItem { .listItem {
margin-bottom: 8px; margin-bottom: 8px;
padding-left: 1.3em; padding-left: 1.3em;
} }
.checkmark { .checkmark {
padding-left: 1.6em; padding-left: 1.6em;
} }
.checkmark::before, .disc::before { .checkmark::before,
position:relative; .disc::before {
top: 4px; position: relative;
display: inline-block; top: 4px;
height: 0px; display: inline-block;
width: 0px; height: 0px;
width: 0px;
} }
.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;
} }
.disc::before { .disc::before {
content: "•"; content: "•";
color: rgb(157, 160, 161); color: rgb(157, 160, 161);
font-size: 26px; font-size: 26px;
left: -0.7em; left: -0.7em;
} }
.link { .link {
border-bottom: 1px dotted #00838e; border-bottom: 1px dotted #00838e;
color: #00838e; color: #00838e;
text-decoration: none; text-decoration: none;
background-color: transparent; background-color: transparent;
} }
.link:active, .link:hover { .link:active,
text-decoration: underline; .link:hover {
outline: 0; text-decoration: underline;
outline: 0;
} }
.link:hover { .link:hover {
border-bottom: none; border-bottom: none;
} }
@media screen and (min-width: 950px) { @media screen and (min-width: 950px) {
.title { .title {
font-size: 1.625rem; font-size: 1.625rem;
} }
} }

View File

@@ -1,7 +1,3 @@
export default function Puffs() { export default function Puffs() {
return ( return <></>
<>
</>
)
} }

View File

@@ -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"

View File

@@ -1,11 +1,10 @@
.wrapper { .wrapper {
background-color: #fff; background-color: #fff;
padding: 20px 10px 5px; padding: 20px 10px 5px;
} }
@media screen and (min-width: 740px) { @media screen and (min-width: 740px) {
.wrapper { .wrapper {
padding:20px 0 0; padding: 20px 0 0;
}
} }
}

View File

@@ -1,8 +1,8 @@
.wrapper { .wrapper {
width: 100%; width: 100%;
position: relative; position: relative;
z-index: 10; z-index: 10;
padding-bottom: 50px; padding-bottom: 50px;
background: #f3f2f1; background: #f3f2f1;
display: block; display: block;
} }

View File

@@ -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>
); )
} }

View File

@@ -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>

View File

@@ -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>
); )
} }

View File

@@ -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>
); )
} }

View File

@@ -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>
); )
} }

View File

@@ -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>

View File

@@ -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 nytt</button> <button type="button" className="reload">
Last inn 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>

View File

@@ -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>
); )
} }

View File

@@ -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
} }
} }

View File

@@ -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>
); )
} }

View File

@@ -1,14 +1,14 @@
"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"
export default function InitLivePreview() { export default function InitLivePreview() {
useEffect(() => { useEffect(() => {
if (!ContentstackLivePreview.livePreview) { if (!ContentstackLivePreview.livePreview) {
ContentstackLivePreview.init() ContentstackLivePreview.init()
} }
}, []); }, [])
return null; return null
} }

View File

@@ -1,31 +1,31 @@
.container { .container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 200px; height: 200px;
} }
.spinner { .spinner {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 80px; width: 80px;
height: 80px; height: 80px;
} }
.spinner div { .spinner div {
transform-origin: 40px 40px; transform-origin: 40px 40px;
animation: spinnerAnimation 1.2s linear infinite; animation: spinnerAnimation 1.2s linear infinite;
} }
.spinner div::after { .spinner div::after {
content: " "; content: " ";
display: block; display: block;
position: absolute; position: absolute;
top: 3px; top: 3px;
left: 37px; left: 37px;
width: 6px; width: 6px;
height: 18px; height: 18px;
border-radius: 20%; border-radius: 20%;
background: red; background: red;
} }
@@ -34,57 +34,56 @@
animation-delay: -1.1s; animation-delay: -1.1s;
} }
.spinner div:nth-child(2) { .spinner div:nth-child(2) {
transform: rotate(30deg); transform: rotate(30deg);
animation-delay: -1s; animation-delay: -1s;
} }
.spinner div:nth-child(3) { .spinner div:nth-child(3) {
transform: rotate(60deg); transform: rotate(60deg);
animation-delay: -0.9s; animation-delay: -0.9s;
} }
.spinner div:nth-child(4) { .spinner div:nth-child(4) {
transform: rotate(90deg); transform: rotate(90deg);
animation-delay: -0.8s; animation-delay: -0.8s;
} }
.spinner div:nth-child(5) { .spinner div:nth-child(5) {
transform: rotate(120deg); transform: rotate(120deg);
animation-delay: -0.7s; animation-delay: -0.7s;
} }
.spinner div:nth-child(6) { .spinner div:nth-child(6) {
transform: rotate(150deg); transform: rotate(150deg);
animation-delay: -0.6s; animation-delay: -0.6s;
} }
.spinner div:nth-child(7) { .spinner div:nth-child(7) {
transform: rotate(180deg); transform: rotate(180deg);
animation-delay: -0.5s; animation-delay: -0.5s;
} }
.spinner div:nth-child(8) { .spinner div:nth-child(8) {
transform: rotate(210deg); transform: rotate(210deg);
animation-delay: -0.4s; animation-delay: -0.4s;
} }
.spinner div:nth-child(9) { .spinner div:nth-child(9) {
transform: rotate(240deg); transform: rotate(240deg);
animation-delay: -0.3s; animation-delay: -0.3s;
} }
.spinner div:nth-child(10) { .spinner div:nth-child(10) {
transform: rotate(270deg); transform: rotate(270deg);
animation-delay: -0.2s; animation-delay: -0.2s;
} }
.spinner div:nth-child(11) { .spinner div:nth-child(11) {
transform: rotate(300deg); transform: rotate(300deg);
animation-delay: -0.1s; animation-delay: -0.1s;
} }
.spinner div:nth-child(12) { .spinner div:nth-child(12) {
transform: rotate(330deg); transform: rotate(330deg);
animation-delay: 0s; animation-delay: 0s;
} }
@keyframes spinnerAnimation { @keyframes spinnerAnimation {
0% { 0% {
opacity: 1; opacity: 1;
} }
100% { 100% {
opacity: 0; opacity: 0;
} }
} }

View File

@@ -26,7 +26,7 @@
.currentPage, .currentPage,
.li { .li {
font-size: .875rem; font-size: 0.875rem;
line-height: 1.4em; line-height: 1.4em;
} }
@@ -36,8 +36,7 @@
margin-right: 4px; margin-right: 4px;
} }
@media (min-width: 740px) {
@media (min-width: 740px){
.nav { .nav {
display: block; display: block;
} }

View File

@@ -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}>

View File

@@ -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

View File

@@ -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;
@@ -17,12 +22,12 @@
margin-bottom: 0; margin-bottom: 0;
} }
@media (min-width: 740px){ @media (min-width: 740px) {
.container { .container {
background: transparent; background: transparent;
padding: 30px 30px 15px; padding: 30px 30px 15px;
grid-template-columns: 2fr 1fr; grid-template-columns: 2fr 1fr;
max-width: 1200px; max-width: 1200px;
} }
} }

View File

@@ -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)}

View File

@@ -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>
) )
} }

View File

@@ -1,4 +1,3 @@
.section { .section {
box-sizing: content-box; box-sizing: content-box;
margin: 0 auto; margin: 0 auto;

View File

@@ -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}

View File

@@ -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}
/>
)
} }

View File

@@ -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
} }

View File

@@ -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)
}, },
} }

View File

@@ -6,22 +6,24 @@ 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 }
} return acc
return acc }, {})
}, {})
return embedsByUid return embedsByUid
} }
export function nodeChildrenToHtml( export function nodeChildrenToHtml(
nodes: RTENode[], nodes: RTENode[],
embeds: EmbedByUid, embeds: EmbedByUid,

View File

@@ -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>
); )
} }

View File

@@ -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
View File

@@ -5,4 +5,4 @@ export const env = createEnv({
client: {}, client: {},
emptyStringAsUndefined: true, emptyStringAsUndefined: true,
runtimeEnv: {}, runtimeEnv: {},
}); })

4
env/server.ts vendored
View File

@@ -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,
}, },
}); })

View File

@@ -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")
} }
} }

View File

@@ -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

View File

@@ -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).*)",
], ],
}; }

View File

@@ -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

View File

@@ -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"
]
} }

View File

@@ -1,3 +1,3 @@
export type HeaderProps = { export type HeaderProps = {
pathname: string; pathname: string
}; }

View File

@@ -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
View File

@@ -1 +1 @@
declare module '*.graphql' declare module "*.graphql"

View File

@@ -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

View File

@@ -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>)

View File

@@ -64,5 +64,4 @@ export type List = {
} }
} }
export type ListProps = List export type ListProps = List

View File

@@ -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"]

View File

@@ -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

View File

@@ -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