Merged in feat/SW-1430-cta-button (pull request #1290)
Feat(SW-1430): Add header button on static pages Approved-by: Erik Tiekstra
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
|
import Link from "next/link"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
import Blocks from "@/components/Blocks"
|
import Blocks from "@/components/Blocks"
|
||||||
import Hero from "@/components/Hero"
|
import Hero from "@/components/Hero"
|
||||||
import Sidebar from "@/components/Sidebar"
|
import Sidebar from "@/components/Sidebar"
|
||||||
import SidebarSkeleton from "@/components/Sidebar/SidebarSkeleton"
|
import SidebarSkeleton from "@/components/Sidebar/SidebarSkeleton"
|
||||||
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import LinkChips from "@/components/TempDesignSystem/LinkChips"
|
import LinkChips from "@/components/TempDesignSystem/LinkChips"
|
||||||
import Preamble from "@/components/TempDesignSystem/Text/Preamble"
|
import Preamble from "@/components/TempDesignSystem/Text/Preamble"
|
||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
@@ -33,6 +35,19 @@ export default function StaticPage({
|
|||||||
<Title as="h2">{header.heading}</Title>
|
<Title as="h2">{header.heading}</Title>
|
||||||
<Preamble>{header.preamble}</Preamble>
|
<Preamble>{header.preamble}</Preamble>
|
||||||
</div>
|
</div>
|
||||||
|
{header.top_primary_button?.url ? (
|
||||||
|
<Button
|
||||||
|
size="medium"
|
||||||
|
intent="tertiary"
|
||||||
|
theme="base"
|
||||||
|
asChild
|
||||||
|
className={styles.button}
|
||||||
|
>
|
||||||
|
<Link href={header.top_primary_button.url}>
|
||||||
|
{header.top_primary_button.title}
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
{header.navigation_links ? (
|
{header.navigation_links ? (
|
||||||
<LinkChips chips={header.navigation_links} />
|
<LinkChips chips={header.navigation_links} />
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -58,6 +58,10 @@
|
|||||||
grid-area: main;
|
grid-area: main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.contentContainer {
|
.contentContainer {
|
||||||
padding: var(--Spacing-x4) 0;
|
padding: var(--Spacing-x4) 0;
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#import "../PageLink/AccountPageLink.graphql"
|
||||||
|
#import "../PageLink/CollectionPageLink.graphql"
|
||||||
|
#import "../PageLink/ContentPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationCityPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationCountryPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationOverviewPageLink.graphql"
|
||||||
|
#import "../PageLink/HotelPageLink.graphql"
|
||||||
|
#import "../PageLink/LoyaltyPageLink.graphql"
|
||||||
|
#import "../PageLink/StartPageLink.graphql"
|
||||||
|
|
||||||
|
#import "../AccountPage/Ref.graphql"
|
||||||
|
#import "../CollectionPage/Ref.graphql"
|
||||||
|
#import "../ContentPage/Ref.graphql"
|
||||||
|
#import "../DestinationCityPage/Ref.graphql"
|
||||||
|
#import "../DestinationCountryPage/Ref.graphql"
|
||||||
|
#import "../DestinationOverviewPage/Ref.graphql"
|
||||||
|
#import "../HotelPage/Ref.graphql"
|
||||||
|
#import "../LoyaltyPage/Ref.graphql"
|
||||||
|
#import "../StartPage/Ref.graphql"
|
||||||
|
|
||||||
|
fragment TopPrimaryButton_CollectionPage on CollectionPageHeader {
|
||||||
|
top_primary_button {
|
||||||
|
title
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageLink
|
||||||
|
...CollectionPageLink
|
||||||
|
...ContentPageLink
|
||||||
|
...DestinationCityPageLink
|
||||||
|
...DestinationCountryPageLink
|
||||||
|
...DestinationOverviewPageLink
|
||||||
|
...HotelPageLink
|
||||||
|
...LoyaltyPageLink
|
||||||
|
...StartPageLink
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment TopPrimaryButtonRef_CollectionPage on CollectionPageHeader {
|
||||||
|
top_primary_button {
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageRef
|
||||||
|
...CollectionPageRef
|
||||||
|
...ContentPageRef
|
||||||
|
...DestinationCityPageRef
|
||||||
|
...DestinationCountryPageRef
|
||||||
|
...DestinationOverviewPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...StartPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql
Normal file
62
lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#import "../PageLink/AccountPageLink.graphql"
|
||||||
|
#import "../PageLink/CollectionPageLink.graphql"
|
||||||
|
#import "../PageLink/ContentPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationCityPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationCountryPageLink.graphql"
|
||||||
|
#import "../PageLink/DestinationOverviewPageLink.graphql"
|
||||||
|
#import "../PageLink/HotelPageLink.graphql"
|
||||||
|
#import "../PageLink/LoyaltyPageLink.graphql"
|
||||||
|
#import "../PageLink/StartPageLink.graphql"
|
||||||
|
|
||||||
|
#import "../AccountPage/Ref.graphql"
|
||||||
|
#import "../CollectionPage/Ref.graphql"
|
||||||
|
#import "../ContentPage/Ref.graphql"
|
||||||
|
#import "../DestinationCityPage/Ref.graphql"
|
||||||
|
#import "../DestinationCountryPage/Ref.graphql"
|
||||||
|
#import "../DestinationOverviewPage/Ref.graphql"
|
||||||
|
#import "../HotelPage/Ref.graphql"
|
||||||
|
#import "../LoyaltyPage/Ref.graphql"
|
||||||
|
#import "../StartPage/Ref.graphql"
|
||||||
|
|
||||||
|
fragment TopPrimaryButton_ContentPage on ContentPageHeader {
|
||||||
|
top_primary_button {
|
||||||
|
title
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageLink
|
||||||
|
...CollectionPageLink
|
||||||
|
...ContentPageLink
|
||||||
|
...DestinationCityPageLink
|
||||||
|
...DestinationCountryPageLink
|
||||||
|
...DestinationOverviewPageLink
|
||||||
|
...HotelPageLink
|
||||||
|
...LoyaltyPageLink
|
||||||
|
...StartPageLink
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment TopPrimaryButtonRef_ContentPage on ContentPageHeader {
|
||||||
|
top_primary_button {
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageRef
|
||||||
|
...CollectionPageRef
|
||||||
|
...ContentPageRef
|
||||||
|
...DestinationCityPageRef
|
||||||
|
...DestinationCountryPageRef
|
||||||
|
...DestinationOverviewPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...StartPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#import "../../Fragments/Blocks/UspGrid.graphql"
|
#import "../../Fragments/Blocks/UspGrid.graphql"
|
||||||
|
|
||||||
#import "../../Fragments/CollectionPage/NavigationLinks.graphql"
|
#import "../../Fragments/CollectionPage/NavigationLinks.graphql"
|
||||||
|
#import "../../Fragments/CollectionPage/TopPrimaryButton.graphql"
|
||||||
|
|
||||||
query GetCollectionPage($locale: String!, $uid: String!) {
|
query GetCollectionPage($locale: String!, $uid: String!) {
|
||||||
collection_page(uid: $uid, locale: $locale) {
|
collection_page(uid: $uid, locale: $locale) {
|
||||||
@@ -14,6 +15,7 @@ query GetCollectionPage($locale: String!, $uid: String!) {
|
|||||||
header {
|
header {
|
||||||
heading
|
heading
|
||||||
preamble
|
preamble
|
||||||
|
...TopPrimaryButton_CollectionPage
|
||||||
...NavigationLinks_CollectionPage
|
...NavigationLinks_CollectionPage
|
||||||
}
|
}
|
||||||
blocks {
|
blocks {
|
||||||
@@ -37,6 +39,7 @@ query GetCollectionPage($locale: String!, $uid: String!) {
|
|||||||
query GetCollectionPageRefs($locale: String!, $uid: String!) {
|
query GetCollectionPageRefs($locale: String!, $uid: String!) {
|
||||||
collection_page(locale: $locale, uid: $uid) {
|
collection_page(locale: $locale, uid: $uid) {
|
||||||
header {
|
header {
|
||||||
|
...TopPrimaryButtonRef_CollectionPage
|
||||||
...NavigationLinksRef_CollectionPage
|
...NavigationLinksRef_CollectionPage
|
||||||
}
|
}
|
||||||
blocks {
|
blocks {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#import "../../Fragments/Blocks/TextCols.graphql"
|
#import "../../Fragments/Blocks/TextCols.graphql"
|
||||||
#import "../../Fragments/Blocks/UspGrid.graphql"
|
#import "../../Fragments/Blocks/UspGrid.graphql"
|
||||||
#import "../../Fragments/ContentPage/NavigationLinks.graphql"
|
#import "../../Fragments/ContentPage/NavigationLinks.graphql"
|
||||||
|
#import "../../Fragments/ContentPage/TopPrimaryButton.graphql"
|
||||||
|
|
||||||
#import "../../Fragments/Sidebar/Content.graphql"
|
#import "../../Fragments/Sidebar/Content.graphql"
|
||||||
#import "../../Fragments/Sidebar/DynamicContent.graphql"
|
#import "../../Fragments/Sidebar/DynamicContent.graphql"
|
||||||
@@ -25,6 +26,7 @@ query GetContentPage($locale: String!, $uid: String!) {
|
|||||||
header {
|
header {
|
||||||
heading
|
heading
|
||||||
preamble
|
preamble
|
||||||
|
...TopPrimaryButton_ContentPage
|
||||||
...NavigationLinks_ContentPage
|
...NavigationLinks_ContentPage
|
||||||
}
|
}
|
||||||
blocks {
|
blocks {
|
||||||
@@ -79,6 +81,7 @@ query GetContentPageRefs($locale: String!, $uid: String!) {
|
|||||||
content_page(locale: $locale, uid: $uid) {
|
content_page(locale: $locale, uid: $uid) {
|
||||||
header {
|
header {
|
||||||
...NavigationLinksRef_ContentPage
|
...NavigationLinksRef_ContentPage
|
||||||
|
...TopPrimaryButtonRef_ContentPage
|
||||||
}
|
}
|
||||||
sidebar {
|
sidebar {
|
||||||
__typename
|
__typename
|
||||||
|
|||||||
@@ -74,6 +74,18 @@ const navigationLinksSchema = z
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const topPrimaryButtonSchema = linkAndTitleSchema
|
||||||
|
.nullable()
|
||||||
|
.transform((data) => {
|
||||||
|
if (!data?.link) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
url: data.link.url,
|
||||||
|
title: data.title || data.link.title || null,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Content Page Schema and types
|
// Content Page Schema and types
|
||||||
export const collectionPageSchema = z.object({
|
export const collectionPageSchema = z.object({
|
||||||
collection_page: z.object({
|
collection_page: z.object({
|
||||||
@@ -83,6 +95,7 @@ export const collectionPageSchema = z.object({
|
|||||||
header: z.object({
|
header: z.object({
|
||||||
heading: z.string(),
|
heading: z.string(),
|
||||||
preamble: z.string(),
|
preamble: z.string(),
|
||||||
|
top_primary_button: topPrimaryButtonSchema,
|
||||||
navigation_links: navigationLinksSchema,
|
navigation_links: navigationLinksSchema,
|
||||||
}),
|
}),
|
||||||
system: systemSchema.merge(
|
system: systemSchema.merge(
|
||||||
@@ -133,6 +146,7 @@ const collectionPageBlockRefsItem = z.discriminatedUnion("__typename", [
|
|||||||
|
|
||||||
const collectionPageHeaderRefs = z.object({
|
const collectionPageHeaderRefs = z.object({
|
||||||
navigation_links: z.array(linkConnectionRefs),
|
navigation_links: z.array(linkConnectionRefs),
|
||||||
|
top_primary_button: linkConnectionRefs.nullable(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const collectionPageRefsSchema = z.object({
|
export const collectionPageRefsSchema = z.object({
|
||||||
|
|||||||
@@ -186,6 +186,18 @@ const navigationLinksSchema = z
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const topPrimaryButtonSchema = linkAndTitleSchema
|
||||||
|
.nullable()
|
||||||
|
.transform((data) => {
|
||||||
|
if (!data?.link) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
url: data.link.url,
|
||||||
|
title: data.title || data.link.title || null,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Content Page Schema and types
|
// Content Page Schema and types
|
||||||
export const contentPageSchema = z.object({
|
export const contentPageSchema = z.object({
|
||||||
content_page: z.object({
|
content_page: z.object({
|
||||||
@@ -196,6 +208,7 @@ export const contentPageSchema = z.object({
|
|||||||
header: z.object({
|
header: z.object({
|
||||||
heading: z.string(),
|
heading: z.string(),
|
||||||
preamble: z.string(),
|
preamble: z.string(),
|
||||||
|
top_primary_button: topPrimaryButtonSchema,
|
||||||
navigation_links: navigationLinksSchema,
|
navigation_links: navigationLinksSchema,
|
||||||
}),
|
}),
|
||||||
system: systemSchema.merge(
|
system: systemSchema.merge(
|
||||||
@@ -305,6 +318,7 @@ const contentPageSidebarRefsItem = z.discriminatedUnion("__typename", [
|
|||||||
|
|
||||||
const contentPageHeaderRefs = z.object({
|
const contentPageHeaderRefs = z.object({
|
||||||
navigation_links: z.array(linkConnectionRefs),
|
navigation_links: z.array(linkConnectionRefs),
|
||||||
|
top_primary_button: linkConnectionRefs.nullable(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const contentPageRefsSchema = z.object({
|
export const contentPageRefsSchema = z.object({
|
||||||
|
|||||||
Reference in New Issue
Block a user