feat(SW-1269): added dynamic content to collection page
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
background-color: var(--UI-Opacity-White-100);
|
background-color: var(--UI-Opacity-White-100);
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
margin: 0 calc(var(--Spacing-x2) * -1) calc(var(--Spacing-x9) * -1)
|
margin: 0 calc(0px - var(--Spacing-x2)) calc(0px - var(--Spacing-x9))
|
||||||
calc(var(--Spacing-x2) * -1);
|
calc(0px - var(--Spacing-x2));
|
||||||
padding-bottom: var(--Spacing-x9);
|
padding-bottom: var(--Spacing-x9);
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,13 @@
|
|||||||
padding-left: var(--Spacing-x1);
|
padding-left: var(--Spacing-x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 768px) {
|
||||||
|
.mobileColumns {
|
||||||
|
padding-bottom: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
@media screen and (min-width: 950px) {
|
||||||
.mobileColumns {
|
.mobileColumns {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import SectionHeader from "@/components/Section/Header"
|
import SectionHeader from "@/components/Section/Header"
|
||||||
import SectionLink from "@/components/Section/Link"
|
import SectionLink from "@/components/Section/Link"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|
||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
|
||||||
|
|
||||||
import styles from "./sectionWrapper.module.css"
|
|
||||||
|
|
||||||
import type { DynamicContentProps } from "@/types/components/blocks/dynamicContent"
|
import type { DynamicContentProps } from "@/types/components/blocks/dynamicContent"
|
||||||
import { DynamicContentEnum } from "@/types/enums/dynamicContent"
|
|
||||||
|
|
||||||
export default function SectionWrapper({
|
export default function SectionWrapper({
|
||||||
children,
|
children,
|
||||||
@@ -19,17 +14,9 @@ export default function SectionWrapper({
|
|||||||
dynamic_content.subtitle ||
|
dynamic_content.subtitle ||
|
||||||
dynamic_content.title
|
dynamic_content.title
|
||||||
)
|
)
|
||||||
const isOverviewTable =
|
|
||||||
dynamic_content.component ===
|
|
||||||
DynamicContentEnum.Blocks.components.overview_table
|
|
||||||
return (
|
return (
|
||||||
<SectionContainer className={styles.container}>
|
<SectionContainer>
|
||||||
{isOverviewTable ? (
|
{displayHeader ? (
|
||||||
<div className={styles.header}>
|
|
||||||
<Title className={styles.tableTitle}> {dynamic_content.title}</Title>
|
|
||||||
<Subtitle>{dynamic_content.subtitle}</Subtitle>
|
|
||||||
</div>
|
|
||||||
) : displayHeader ? (
|
|
||||||
<SectionHeader
|
<SectionHeader
|
||||||
link={dynamic_content.link}
|
link={dynamic_content.link}
|
||||||
preamble={dynamic_content.subtitle}
|
preamble={dynamic_content.subtitle}
|
||||||
@@ -38,7 +25,7 @@ export default function SectionWrapper({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{children}
|
{children}
|
||||||
{displayHeader ? (
|
{dynamic_content.link ? (
|
||||||
<SectionLink link={dynamic_content.link} variant="mobile" />
|
<SectionLink link={dynamic_content.link} variant="mobile" />
|
||||||
) : null}
|
) : null}
|
||||||
</SectionContainer>
|
</SectionContainer>
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
.container {
|
|
||||||
/* These negative margins are needed for getting the right background color for mobile loyalty table overview */
|
|
||||||
margin: 0 calc(0px - var(--Spacing-x2)) calc(0px - var(--Spacing-x9))
|
|
||||||
calc(0px - var(--Spacing-x2));
|
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 0 var(--Spacing-x2) var(--Spacing-x9) var(--Spacing-x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
display: grid;
|
|
||||||
gap: var(--Spacing-x1);
|
|
||||||
padding-bottom: var(--Spacing-x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tableTitle {
|
|
||||||
text-wrap: balance;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preamble {
|
|
||||||
color: var(--Base-Text-High-contrast);
|
|
||||||
font-size: var(--typography-Body-Regular-fontSize);
|
|
||||||
line-height: var(--typography-Body-Regular-lineHeight);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
|
||||||
.header {
|
|
||||||
width: 800px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
.container {
|
.container {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
.title,
|
.title,
|
||||||
.preamble {
|
.preamble {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
|
max-width: var(--max-width-text-block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
.linkWrapper {
|
.linkWrapper {
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
gap: var(--Spacing-x-half);
|
gap: var(--Spacing-x-half);
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile {
|
.mobile {
|
||||||
|
|||||||
@@ -52,6 +52,48 @@ fragment DynamicContent_AccountPageRefs on AccountPageContentDynamicContent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragment DynamicContent_CollectionPage on CollectionPageBlocksDynamicContent {
|
||||||
|
dynamic_content {
|
||||||
|
component
|
||||||
|
subtitle
|
||||||
|
title
|
||||||
|
link {
|
||||||
|
text
|
||||||
|
linkConnection: pageConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageLink
|
||||||
|
...ContentPageLink
|
||||||
|
...CollectionPageLink
|
||||||
|
...HotelPageLink
|
||||||
|
...LoyaltyPageLink
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment DynamicContent_CollectionPageRefs on CollectionPageBlocksDynamicContent {
|
||||||
|
dynamic_content {
|
||||||
|
link {
|
||||||
|
linkConnection: pageConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...ContentPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...AccountPageRef
|
||||||
|
...CollectionPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fragment DynamicContent_ContentPage on ContentPageBlocksDynamicContent {
|
fragment DynamicContent_ContentPage on ContentPageBlocksDynamicContent {
|
||||||
dynamic_content {
|
dynamic_content {
|
||||||
component
|
component
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#import "../../Fragments/System.graphql"
|
#import "../../Fragments/System.graphql"
|
||||||
|
|
||||||
#import "../../Fragments/Blocks/CardsGrid.graphql"
|
#import "../../Fragments/Blocks/CardsGrid.graphql"
|
||||||
|
#import "../../Fragments/Blocks/DynamicContent.graphql"
|
||||||
#import "../../Fragments/Blocks/Shortcuts.graphql"
|
#import "../../Fragments/Blocks/Shortcuts.graphql"
|
||||||
#import "../../Fragments/Blocks/UspGrid.graphql"
|
#import "../../Fragments/Blocks/UspGrid.graphql"
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ query GetCollectionPage($locale: String!, $uid: String!) {
|
|||||||
...CardsGrid_CollectionPage
|
...CardsGrid_CollectionPage
|
||||||
...Shortcuts_CollectionPage
|
...Shortcuts_CollectionPage
|
||||||
...UspGrid_CollectionPage
|
...UspGrid_CollectionPage
|
||||||
|
...DynamicContent_CollectionPage
|
||||||
}
|
}
|
||||||
system {
|
system {
|
||||||
...System
|
...System
|
||||||
@@ -42,6 +44,7 @@ query GetCollectionPageRefs($locale: String!, $uid: String!) {
|
|||||||
...CardsGrid_CollectionPageRefs
|
...CardsGrid_CollectionPageRefs
|
||||||
...Shortcuts_CollectionPageRefs
|
...Shortcuts_CollectionPageRefs
|
||||||
...UspGrid_CollectionPageRefs
|
...UspGrid_CollectionPageRefs
|
||||||
|
...DynamicContent_CollectionPageRefs
|
||||||
}
|
}
|
||||||
system {
|
system {
|
||||||
...System
|
...System
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import {
|
|||||||
cardGridRefsSchema,
|
cardGridRefsSchema,
|
||||||
cardsGridSchema,
|
cardsGridSchema,
|
||||||
} from "../schemas/blocks/cardsGrid"
|
} from "../schemas/blocks/cardsGrid"
|
||||||
|
import {
|
||||||
|
dynamicContentRefsSchema,
|
||||||
|
dynamicContentSchema as blockDynamicContentSchema,
|
||||||
|
} from "../schemas/blocks/dynamicContent"
|
||||||
import {
|
import {
|
||||||
shortcutsRefsSchema,
|
shortcutsRefsSchema,
|
||||||
shortcutsSchema,
|
shortcutsSchema,
|
||||||
@@ -39,8 +43,17 @@ export const collectionPageUspGrid = z
|
|||||||
})
|
})
|
||||||
.merge(uspGridSchema)
|
.merge(uspGridSchema)
|
||||||
|
|
||||||
|
export const collectionPageDynamicContent = z
|
||||||
|
.object({
|
||||||
|
__typename: z.literal(
|
||||||
|
CollectionPageEnum.ContentStack.blocks.DynamicContent
|
||||||
|
),
|
||||||
|
})
|
||||||
|
.merge(blockDynamicContentSchema)
|
||||||
|
|
||||||
export const blocksSchema = z.discriminatedUnion("__typename", [
|
export const blocksSchema = z.discriminatedUnion("__typename", [
|
||||||
collectionPageCards,
|
collectionPageCards,
|
||||||
|
collectionPageDynamicContent,
|
||||||
collectionPageShortcuts,
|
collectionPageShortcuts,
|
||||||
collectionPageUspGrid,
|
collectionPageUspGrid,
|
||||||
])
|
])
|
||||||
@@ -103,8 +116,17 @@ const collectionPageUspGridRefs = z
|
|||||||
})
|
})
|
||||||
.merge(uspGridRefsSchema)
|
.merge(uspGridRefsSchema)
|
||||||
|
|
||||||
|
const contentPageDynamicContentRefs = z
|
||||||
|
.object({
|
||||||
|
__typename: z.literal(
|
||||||
|
CollectionPageEnum.ContentStack.blocks.DynamicContent
|
||||||
|
),
|
||||||
|
})
|
||||||
|
.merge(dynamicContentRefsSchema)
|
||||||
|
|
||||||
const collectionPageBlockRefsItem = z.discriminatedUnion("__typename", [
|
const collectionPageBlockRefsItem = z.discriminatedUnion("__typename", [
|
||||||
collectionPageShortcutsRefs,
|
collectionPageShortcutsRefs,
|
||||||
|
contentPageDynamicContentRefs,
|
||||||
collectionPageCardsRefs,
|
collectionPageCardsRefs,
|
||||||
collectionPageUspGridRefs,
|
collectionPageUspGridRefs,
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ export namespace CollectionPageEnum {
|
|||||||
export namespace ContentStack {
|
export namespace ContentStack {
|
||||||
export const enum blocks {
|
export const enum blocks {
|
||||||
CardsGrid = "CollectionPageBlocksCardsGrid",
|
CardsGrid = "CollectionPageBlocksCardsGrid",
|
||||||
|
DynamicContent = "CollectionPageBlocksDynamicContent",
|
||||||
Shortcuts = "CollectionPageBlocksShortcuts",
|
Shortcuts = "CollectionPageBlocksShortcuts",
|
||||||
UspGrid = "CollectionPageBlocksUspGrid",
|
UspGrid = "CollectionPageBlocksUspGrid",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user