feat(WEB-131): add loyalty page

This commit is contained in:
Christel Westerberg
2024-04-17 16:20:55 +02:00
parent 4243056fe8
commit c00f7b78eb
21 changed files with 386 additions and 11 deletions

View File

@@ -1,10 +1,12 @@
import { headingVariants } from "@/components/MyPages/Title/variants"
import { headingVariants } from "@/components/Title/variants"
import type { VariantProps } from "class-variance-authority"
type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement>, VariantProps<typeof headingVariants> {
export interface HeadingProps
extends React.HTMLAttributes<HTMLHeadingElement>,
VariantProps<typeof headingVariants> {
as?: HeadingLevel
level?: HeadingLevel
uppercase?: boolean

View File

@@ -0,0 +1,104 @@
import type { AllRequestResponse } from "./utils/all"
import type { Typename } from "./utils/typename"
enum SidebarTypenameEnum {
LoyaltyPageSidebarLoyaltyJoinContact = "LoyaltyPageSidebarLoyaltyJoinContact",
LoyaltyPageSidebarContent = "LoyaltyPageSidebarContent",
}
type SidebarContent = {}
type JoinContact = {}
export type Sidebar =
| Typename<SidebarContent, SidebarTypenameEnum.LoyaltyPageSidebarContent>
| Typename<
JoinContact,
SidebarTypenameEnum.LoyaltyPageSidebarLoyaltyJoinContact
>
enum ContentBlocks {
LoyaltyPageContentLoyaltyLevels = "LoyaltyPageContentLoyaltyLevels",
LoyaltyPageContentCardGrid = "LoyaltyPageContentCardGrid",
}
enum LinkedPageConnection {
LoyaltyPage = "LoyaltyPage",
ContentPage = "ContentPage",
AccountPage = "AccountPage",
}
type ContentPageLink = {
web: { url: string }
}
type LoyaltyPageLink = {
url: string
}
type AccountPageLink = {
url: string
}
type LinkedPage =
| Typename<ContentPageLink, LinkedPageConnection.ContentPage>
| Typename<LoyaltyPageLink, ContentBlocks.LoyaltyPageContentLoyaltyLevels>
| Typename<AccountPageLink, ContentBlocks.LoyaltyPageContentLoyaltyLevels>
type CardGrid = {
card_grid: {
heading: string
subheading: string
cards: {
referenceConnection: {
edges: {
node: LinkedPage
}
}
heading: string
subheading: string
}
}
}
type LoyaltyLevels = {
loyalty_levels: {
heading: string
sub_heading?: string
level_card: {
loyalty_level: number
}[]
}
}
export type Content =
| Typename<CardGrid, ContentBlocks.LoyaltyPageContentCardGrid>
| Typename<LoyaltyLevels, ContentBlocks.LoyaltyPageContentLoyaltyLevels>
export type Breadcrumb = {
href: string
title: string
}
export type Breadcrumbs = {
parents: Breadcrumb[]
title: string
}
export type LoyaltyPage = {
sidebar: Sidebar[]
content: Content[]
web: {
breadcrumbs: Breadcrumbs
}
system: {
created_at: string
uid: string
updated_at: string
}
title: string
url: string
}
export type GetLoyaltyPageData = {
all_loyalty_page: AllRequestResponse<LoyaltyPage>
}