feat(SW-285): add missing code for dynamic content

This commit is contained in:
Chuma McPhoy
2024-09-02 20:04:58 +02:00
parent 1c2a34591b
commit 60636d8cbe
12 changed files with 206 additions and 10 deletions
+91
View File
@@ -1,8 +1,13 @@
import { Lang } from "@/constants/languages"
import { membershipLevels } from "@/constants/membershipLevels"
import {
Block,
CardsGrid,
DynamicContent,
} from "@/server/routers/contentstack/contentPage/output"
import type { IntlFormatters } from "@formatjs/intl"
export type BlocksProps = {
blocks: Block[]
}
@@ -10,3 +15,89 @@ export type BlocksProps = {
export type CardsGridProps = Pick<CardsGrid, "cards_grid"> & {
firstItem?: boolean
}
export type DynamicContentProps = {
dynamicContent: DynamicContent["dynamic_content"]
firstItem: boolean
}
export type DynamicComponentProps = {
component: DynamicContent["dynamic_content"]["component"]
}
type BenefitTitle = { title: string }
export type Level = {
level: membershipLevels
name: string
requiredPoints: number
requiredNights?: number
benefits: BenefitTitle[]
}
export type LevelCardProps = {
formatMessage: IntlFormatters["formatMessage"]
lang: Lang
level: Level
}
export type BenefitCardProps = {
comparedValues: BenefitValueInformation[]
title: string
description: string
}
type BenefitValueInformation = {
unlocked: boolean
value?: string
valueDetails?: string
}
export type Benefit = {
name: string
description: string
unlocked: boolean
value?: string
valueDetails?: string
}
export type ComparisonLevel = {
level: membershipLevels
name: string
description: string
requirement: string
icon: string
benefits: Benefit[]
}
export type BenefitListProps = {
levels: ComparisonLevel[]
}
export type BenefitValueProps = {
benefit: BenefitValueInformation
}
export type MobileColumnHeaderProps = {
column: "A" | "B"
}
export type DesktopSelectColumns = {
column: MobileColumnHeaderProps["column"] | "C"
}
export type LargeTableProps = {
levels: ComparisonLevel[]
activeLevel: membershipLevels | null
Select?: (column: DesktopSelectColumns) => JSX.Element | null
}
export type BenefitTableHeaderProps = {
name: string
description: string
}
export type LevelSummaryProps = {
level: ComparisonLevel
showDescription?: boolean
}
+7
View File
@@ -2,9 +2,16 @@ export enum ContentBlocksTypenameEnum {
ContentPageBlocksContent = "ContentPageBlocksContent",
ContentPageBlocksShortcuts = "ContentPageBlocksShortcuts",
ContentPageBlocksCardsGrid = "ContentPageBlocksCardsGrid",
ContentPageBlocksDynamicContent = "ContentPageBlocksDynamicContent",
}
export enum CardsGridEnum {
LoyaltyCard = "LoyaltyCard",
Card = "Card",
}
export enum DynamicContentComponentEnum {
loyalty_levels = "loyalty_levels",
how_it_works = "how_it_works",
overview_table = "overview_table",
}