feat/BOOK-755 alert content pages
* feat(BOOK-755): Added alert block on Collection pages * feat(BOOK-755): Added alert block on Content pages * feat(BOOK-755): Added alert functionality for RTE Approved-by: Bianca Widstam
This commit is contained in:
@@ -4,7 +4,9 @@ import { nodesToHtml } from "./utils"
|
||||
|
||||
import styles from "./jsontohtml.module.css"
|
||||
|
||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
import { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault"
|
||||
import { AlertSidepeekContent } from "../../types/sidepeekContent"
|
||||
import { ContentBlockType } from "./types/rte/enums"
|
||||
import type { RTENode } from "./types/rte/node"
|
||||
import type { RenderOptions } from "./types/rte/option"
|
||||
@@ -15,7 +17,7 @@ export type Node<T> = {
|
||||
|
||||
export type Embeds =
|
||||
| {
|
||||
__typename: Exclude<ContentBlockType, "ImageContainer">
|
||||
__typename: Exclude<ContentBlockType, "ImageContainer" | "Alert">
|
||||
system?: { uid: string } | null
|
||||
url?: string | null
|
||||
permanent_url?: string | null
|
||||
@@ -29,6 +31,25 @@ export type Embeds =
|
||||
image_left?: ImageVaultAsset
|
||||
image_right?: ImageVaultAsset
|
||||
}
|
||||
| {
|
||||
__typename: "Alert"
|
||||
system?: { uid: string } | null
|
||||
type: AlertTypeEnum
|
||||
heading: string | null
|
||||
text: string
|
||||
phoneContact?: {
|
||||
displayText: string
|
||||
phoneNumber: string
|
||||
footnote?: string | null
|
||||
} | null
|
||||
sidepeekContent?: AlertSidepeekContent | null
|
||||
sidepeekCtaText?: string | null
|
||||
link?: {
|
||||
url: string
|
||||
title: string
|
||||
keepSearchParams?: boolean
|
||||
} | null
|
||||
}
|
||||
|
||||
export type EmbedByUid = Record<string, Node<Embeds>>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
mapImageVaultAssetResponseToImageVaultAsset,
|
||||
mapInsertResponseToImageVaultAsset,
|
||||
} from "@scandic-hotels/common/utils/imageVault"
|
||||
import { Alert } from "../Alert"
|
||||
import { TextLink } from "../TextLink"
|
||||
import type { EmbedByUid } from "./JsonToHtml"
|
||||
import type { Attributes } from "./types/rte/attrs"
|
||||
@@ -458,6 +459,8 @@ export const renderOptions: RenderOptions = {
|
||||
)
|
||||
}
|
||||
return null
|
||||
} else if (entry?.node.__typename === "Alert") {
|
||||
return <Alert key={node.uid} {...entry.node} />
|
||||
} else if (
|
||||
entry?.node.__typename === "AccountPage" ||
|
||||
entry?.node.__typename === "CampaignOverviewPage" ||
|
||||
|
||||
Reference in New Issue
Block a user