diff --git a/components/ContentType/StaticPages/index.tsx b/components/ContentType/StaticPages/index.tsx index dc59a1046..689761952 100644 --- a/components/ContentType/StaticPages/index.tsx +++ b/components/ContentType/StaticPages/index.tsx @@ -1,9 +1,11 @@ +import Link from "next/link" import { Suspense } from "react" import Blocks from "@/components/Blocks" import Hero from "@/components/Hero" import Sidebar from "@/components/Sidebar" import SidebarSkeleton from "@/components/Sidebar/SidebarSkeleton" +import Button from "@/components/TempDesignSystem/Button" import LinkChips from "@/components/TempDesignSystem/LinkChips" import Preamble from "@/components/TempDesignSystem/Text/Preamble" import Title from "@/components/TempDesignSystem/Text/Title" @@ -33,6 +35,19 @@ export default function StaticPage({ {header.heading} {header.preamble} + {header.top_primary_button?.url ? ( + + ) : null} {header.navigation_links ? ( ) : null} diff --git a/components/ContentType/StaticPages/staticPage.module.css b/components/ContentType/StaticPages/staticPage.module.css index 775e4a1f3..57f4ea4f0 100644 --- a/components/ContentType/StaticPages/staticPage.module.css +++ b/components/ContentType/StaticPages/staticPage.module.css @@ -58,6 +58,10 @@ grid-area: main; } +.button { + width: fit-content; +} + @media (min-width: 768px) { .contentContainer { padding: var(--Spacing-x4) 0; diff --git a/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql b/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql new file mode 100644 index 000000000..ea3189ed5 --- /dev/null +++ b/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql @@ -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 + } + } + } + } +} diff --git a/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql b/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql new file mode 100644 index 000000000..5b14474b9 --- /dev/null +++ b/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql @@ -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 + } + } + } + } +} diff --git a/lib/graphql/Query/CollectionPage/CollectionPage.graphql b/lib/graphql/Query/CollectionPage/CollectionPage.graphql index 41bc621c5..e57bfebcd 100644 --- a/lib/graphql/Query/CollectionPage/CollectionPage.graphql +++ b/lib/graphql/Query/CollectionPage/CollectionPage.graphql @@ -6,6 +6,7 @@ #import "../../Fragments/Blocks/UspGrid.graphql" #import "../../Fragments/CollectionPage/NavigationLinks.graphql" +#import "../../Fragments/CollectionPage/TopPrimaryButton.graphql" query GetCollectionPage($locale: String!, $uid: String!) { collection_page(uid: $uid, locale: $locale) { @@ -14,6 +15,7 @@ query GetCollectionPage($locale: String!, $uid: String!) { header { heading preamble + ...TopPrimaryButton_CollectionPage ...NavigationLinks_CollectionPage } blocks { @@ -37,6 +39,7 @@ query GetCollectionPage($locale: String!, $uid: String!) { query GetCollectionPageRefs($locale: String!, $uid: String!) { collection_page(locale: $locale, uid: $uid) { header { + ...TopPrimaryButtonRef_CollectionPage ...NavigationLinksRef_CollectionPage } blocks { diff --git a/lib/graphql/Query/ContentPage/ContentPage.graphql b/lib/graphql/Query/ContentPage/ContentPage.graphql index 87b7f285f..99d194225 100644 --- a/lib/graphql/Query/ContentPage/ContentPage.graphql +++ b/lib/graphql/Query/ContentPage/ContentPage.graphql @@ -10,6 +10,7 @@ #import "../../Fragments/Blocks/TextCols.graphql" #import "../../Fragments/Blocks/UspGrid.graphql" #import "../../Fragments/ContentPage/NavigationLinks.graphql" +#import "../../Fragments/ContentPage/TopPrimaryButton.graphql" #import "../../Fragments/Sidebar/Content.graphql" #import "../../Fragments/Sidebar/DynamicContent.graphql" @@ -25,6 +26,7 @@ query GetContentPage($locale: String!, $uid: String!) { header { heading preamble + ...TopPrimaryButton_ContentPage ...NavigationLinks_ContentPage } blocks { @@ -79,6 +81,7 @@ query GetContentPageRefs($locale: String!, $uid: String!) { content_page(locale: $locale, uid: $uid) { header { ...NavigationLinksRef_ContentPage + ...TopPrimaryButtonRef_ContentPage } sidebar { __typename diff --git a/server/routers/contentstack/collectionPage/output.ts b/server/routers/contentstack/collectionPage/output.ts index 4d68e48ed..bb0cee0ae 100644 --- a/server/routers/contentstack/collectionPage/output.ts +++ b/server/routers/contentstack/collectionPage/output.ts @@ -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 export const collectionPageSchema = z.object({ collection_page: z.object({ @@ -83,6 +95,7 @@ export const collectionPageSchema = z.object({ header: z.object({ heading: z.string(), preamble: z.string(), + top_primary_button: topPrimaryButtonSchema, navigation_links: navigationLinksSchema, }), system: systemSchema.merge( @@ -133,6 +146,7 @@ const collectionPageBlockRefsItem = z.discriminatedUnion("__typename", [ const collectionPageHeaderRefs = z.object({ navigation_links: z.array(linkConnectionRefs), + top_primary_button: linkConnectionRefs.nullable(), }) export const collectionPageRefsSchema = z.object({ diff --git a/server/routers/contentstack/contentPage/output.ts b/server/routers/contentstack/contentPage/output.ts index a1c027ade..2975f2576 100644 --- a/server/routers/contentstack/contentPage/output.ts +++ b/server/routers/contentstack/contentPage/output.ts @@ -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 export const contentPageSchema = z.object({ content_page: z.object({ @@ -196,6 +208,7 @@ export const contentPageSchema = z.object({ header: z.object({ heading: z.string(), preamble: z.string(), + top_primary_button: topPrimaryButtonSchema, navigation_links: navigationLinksSchema, }), system: systemSchema.merge( @@ -305,6 +318,7 @@ const contentPageSidebarRefsItem = z.discriminatedUnion("__typename", [ const contentPageHeaderRefs = z.object({ navigation_links: z.array(linkConnectionRefs), + top_primary_button: linkConnectionRefs.nullable(), }) export const contentPageRefsSchema = z.object({