feat(SW-391): Changes after PR
This commit is contained in:
@@ -6,8 +6,7 @@ import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard"
|
|||||||
import TeaserCard from "@/components/TempDesignSystem/TeaserCard"
|
import TeaserCard from "@/components/TempDesignSystem/TeaserCard"
|
||||||
|
|
||||||
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
||||||
import { CardsGridEnum } from "@/types/enums/cardsGrid"
|
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
|
||||||
import { CardsGridLayoutEnum } from "@/types/trpc/routers/contentstack/blocks"
|
|
||||||
|
|
||||||
export default function CardsGrid({
|
export default function CardsGrid({
|
||||||
cards_grid,
|
cards_grid,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function SidePeek({
|
|||||||
aria-label={intl.formatMessage({ id: "Close" })}
|
aria-label={intl.formatMessage({ id: "Close" })}
|
||||||
className={styles.closeButton}
|
className={styles.closeButton}
|
||||||
intent="text"
|
intent="text"
|
||||||
onClick={onClose}
|
onPress={onClose}
|
||||||
>
|
>
|
||||||
<CloseLargeIcon color="burgundy" />
|
<CloseLargeIcon color="burgundy" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ import SidePeek from "../../SidePeek"
|
|||||||
|
|
||||||
import styles from "./sidepeek.module.css"
|
import styles from "./sidepeek.module.css"
|
||||||
|
|
||||||
import { TeaserCardSidepeekProps } from "@/types/components/teaserCard"
|
import type { TeaserCardSidepeekProps } from "@/types/components/teaserCard"
|
||||||
|
|
||||||
export default function TeaserCardSidepeek({
|
export default function TeaserCardSidepeek({
|
||||||
button,
|
button,
|
||||||
data,
|
sidePeekContent,
|
||||||
}: TeaserCardSidepeekProps) {
|
}: TeaserCardSidepeekProps) {
|
||||||
const [sidePeekIsOpen, setSidePeekIsOpen] = useState(false)
|
const [sidePeekIsOpen, setSidePeekIsOpen] = useState(false)
|
||||||
const { heading, content, primary_button, secondary_button } = data
|
const { heading, content, primary_button, secondary_button } = sidePeekContent
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setSidePeekIsOpen(true)}
|
onPress={() => setSidePeekIsOpen(true)}
|
||||||
theme="base"
|
theme="base"
|
||||||
variant="icon"
|
variant="icon"
|
||||||
intent="text"
|
intent="text"
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ export default function TeaserCard({
|
|||||||
{description}
|
{description}
|
||||||
</Body>
|
</Body>
|
||||||
{sidePeekButton && sidePeekContent ? (
|
{sidePeekButton && sidePeekContent ? (
|
||||||
<TeaserCardSidepeek button={sidePeekButton} data={sidePeekContent} />
|
<TeaserCardSidepeek
|
||||||
|
button={sidePeekButton}
|
||||||
|
sidePeekContent={sidePeekContent}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.ctaContainer}>
|
<div className={styles.ctaContainer}>
|
||||||
{primaryButton && (
|
{primaryButton && (
|
||||||
|
|||||||
@@ -30,6 +30,45 @@ fragment TeaserCardBlockRef on TeaserCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sidepeek_content {
|
||||||
|
content {
|
||||||
|
embedded_itemsConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...AccountPageRef
|
||||||
|
...ContentPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
primary_button {
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...ContentPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
secondary_button {
|
||||||
|
linkConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
__typename
|
||||||
|
...ContentPageRef
|
||||||
|
...LoyaltyPageRef
|
||||||
|
...HotelPageRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
system {
|
system {
|
||||||
...System
|
...System
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import { imageSchema } from "./image"
|
|||||||
import { imageContainerSchema } from "./imageContainer"
|
import { imageContainerSchema } from "./imageContainer"
|
||||||
|
|
||||||
import { BlocksEnums } from "@/types/enums/blocks"
|
import { BlocksEnums } from "@/types/enums/blocks"
|
||||||
import { CardsGridEnum } from "@/types/enums/cardsGrid"
|
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
|
||||||
import { CardsGridLayoutEnum } from "@/types/trpc/routers/contentstack/blocks"
|
|
||||||
|
|
||||||
export const cardBlockSchema = z.object({
|
export const cardBlockSchema = z.object({
|
||||||
__typename: z.literal(CardsGridEnum.cards.Card),
|
__typename: z.literal(CardsGridEnum.cards.Card),
|
||||||
@@ -93,18 +92,12 @@ export const teaserCardBlockSchema = z.object({
|
|||||||
secondary_button: buttonSchema,
|
secondary_button: buttonSchema,
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
// sidepeek_content: z
|
|
||||||
// .object({
|
|
||||||
// heading: z.string(),
|
|
||||||
// })
|
|
||||||
// .optional(),
|
|
||||||
system: systemSchema,
|
system: systemSchema,
|
||||||
})
|
})
|
||||||
|
|
||||||
export function transformTeaserCardBlock(
|
export function transformTeaserCardBlock(
|
||||||
card: typeof teaserCardBlockSchema._type
|
card: typeof teaserCardBlockSchema._type
|
||||||
) {
|
) {
|
||||||
console.log({ has_sidepeek_button: card.sidepeek_content })
|
|
||||||
return {
|
return {
|
||||||
__typename: card.__typename,
|
__typename: card.__typename,
|
||||||
body_text: card.body_text,
|
body_text: card.body_text,
|
||||||
|
|||||||
@@ -24,5 +24,5 @@ export interface TeaserCardProps
|
|||||||
|
|
||||||
export interface TeaserCardSidepeekProps {
|
export interface TeaserCardSidepeekProps {
|
||||||
button: SidePeekButton
|
button: SidePeekButton
|
||||||
data: NonNullable<TeaserCard["sidepeek_content"]>
|
sidePeekContent: NonNullable<TeaserCard["sidepeek_content"]>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,3 +5,9 @@ export namespace CardsGridEnum {
|
|||||||
TeaserCard = "TeaserCard",
|
TeaserCard = "TeaserCard",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum CardsGridLayoutEnum {
|
||||||
|
TWO_COLUMNS = "twoColumnGrid",
|
||||||
|
THREE_COLUMNS = "threeColumnGrid",
|
||||||
|
TWO_PLUS_ONE = "twoPlusOne", // Not sure if this is used?
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ import { tableSchema } from "@/server/routers/contentstack/schemas/blocks/table"
|
|||||||
import { textColsSchema } from "@/server/routers/contentstack/schemas/blocks/textCols"
|
import { textColsSchema } from "@/server/routers/contentstack/schemas/blocks/textCols"
|
||||||
import { uspGridSchema } from "@/server/routers/contentstack/schemas/blocks/uspGrid"
|
import { uspGridSchema } from "@/server/routers/contentstack/schemas/blocks/uspGrid"
|
||||||
|
|
||||||
export enum CardsGridLayoutEnum {
|
|
||||||
TWO_COLUMNS = "twoColumnGrid",
|
|
||||||
THREE_COLUMNS = "threeColumnGrid",
|
|
||||||
TWO_PLUS_ONE = "twoPlusOne",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TeaserCard extends z.output<typeof teaserCardBlockSchema> {}
|
export interface TeaserCard extends z.output<typeof teaserCardBlockSchema> {}
|
||||||
export interface CardsGrid extends z.output<typeof cardsGridSchema> {}
|
export interface CardsGrid extends z.output<typeof cardsGridSchema> {}
|
||||||
export interface Content extends z.output<typeof contentSchema> {}
|
export interface Content extends z.output<typeof contentSchema> {}
|
||||||
|
|||||||
Reference in New Issue
Block a user