feat(SW-962): add preamble
This commit is contained in:
@@ -13,7 +13,7 @@ import { ActivitiesSidePeekProps } from "@/types/components/hotelPage/sidepeek/a
|
|||||||
|
|
||||||
export default async function ActivitiesSidePeek({
|
export default async function ActivitiesSidePeek({
|
||||||
preamble,
|
preamble,
|
||||||
contentPage,
|
contentPageLink,
|
||||||
}: ActivitiesSidePeekProps) {
|
}: ActivitiesSidePeekProps) {
|
||||||
const lang = getLang()
|
const lang = getLang()
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
@@ -23,15 +23,13 @@ export default async function ActivitiesSidePeek({
|
|||||||
title={intl.formatMessage({ id: "Activities" })}
|
title={intl.formatMessage({ id: "Activities" })}
|
||||||
>
|
>
|
||||||
<Preamble className={styles.preamble}>{preamble}</Preamble>
|
<Preamble className={styles.preamble}>{preamble}</Preamble>
|
||||||
{contentPage?.href && (
|
<div className={styles.buttonContainer}>
|
||||||
<div className={styles.buttonContainer}>
|
<Button theme="base" intent="secondary" asChild>
|
||||||
<Button theme="base" intent="secondary" asChild>
|
<Link href={contentPageLink} color="burgundy" weight="bold">
|
||||||
<Link href={contentPage.href} color="burgundy" weight="bold">
|
{intl.formatMessage({ id: "Show activities calendar" })}
|
||||||
{intl.formatMessage({ id: "Show activities calendar" })}
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</Button>
|
</div>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</SidePeek>
|
</SidePeek>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,10 +200,12 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
|||||||
Restaurant & Bar
|
Restaurant & Bar
|
||||||
</SidePeek>
|
</SidePeek>
|
||||||
<WellnessAndExerciseSidePeek healthFacilities={healthFacilities} />
|
<WellnessAndExerciseSidePeek healthFacilities={healthFacilities} />
|
||||||
<ActivitiesSidePeek
|
{activitiesCard && (
|
||||||
preamble="This is content about activites"
|
<ActivitiesSidePeek
|
||||||
contentPage={activitiesCard?.contentPage}
|
preamble={activitiesCard.preamble}
|
||||||
/>
|
contentPageLink={activitiesCard.contentPage.href}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<SidePeek
|
<SidePeek
|
||||||
contentKey={meetingsAndConferences[lang]}
|
contentKey={meetingsAndConferences[lang]}
|
||||||
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
||||||
|
|||||||
@@ -56,7 +56,12 @@ query GetHotelPage($locale: String!, $uid: String!) {
|
|||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
__typename
|
__typename
|
||||||
...ContentPageLink
|
... on ContentPage {
|
||||||
|
...ContentPageLink
|
||||||
|
header {
|
||||||
|
preamble
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ export const activitiesCardSchema = z.object({
|
|||||||
edges: z.array(
|
edges: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
node: z.discriminatedUnion("__typename", [
|
node: z.discriminatedUnion("__typename", [
|
||||||
pageLinks.contentPageSchema,
|
pageLinks.contentPageSchema.extend({
|
||||||
|
header: z.object({
|
||||||
|
preamble: z.string(),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
@@ -33,9 +37,11 @@ export const activitiesCardSchema = z.object({
|
|||||||
})
|
})
|
||||||
.transform((data) => {
|
.transform((data) => {
|
||||||
let contentPage = { href: "" }
|
let contentPage = { href: "" }
|
||||||
|
let preamble = ""
|
||||||
if (data.hotel_page_activities_content_pageConnection.edges.length) {
|
if (data.hotel_page_activities_content_pageConnection.edges.length) {
|
||||||
const page =
|
const page =
|
||||||
data.hotel_page_activities_content_pageConnection.edges[0].node
|
data.hotel_page_activities_content_pageConnection.edges[0].node
|
||||||
|
preamble = page.header.preamble
|
||||||
if (page.web.original_url) {
|
if (page.web.original_url) {
|
||||||
contentPage = {
|
contentPage = {
|
||||||
href: page.web.original_url,
|
href: page.web.original_url,
|
||||||
@@ -54,6 +60,7 @@ export const activitiesCardSchema = z.object({
|
|||||||
heading: data.heading,
|
heading: data.heading,
|
||||||
openInNewTab: !!data.open_in_new_tab,
|
openInNewTab: !!data.open_in_new_tab,
|
||||||
scriptedTopTitle: data.scripted_title,
|
scriptedTopTitle: data.scripted_title,
|
||||||
|
preamble,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
export type ActivitiesSidePeekProps = {
|
export type ActivitiesSidePeekProps = {
|
||||||
preamble: string
|
preamble: string
|
||||||
contentPage?: {
|
contentPageLink: string
|
||||||
href: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user