fix(SW-1886): Removed "firstItem" props from blocks as it generates multiple h1 tags on those pages
* feat(SW-1886): Removed "firstItem" props from blocks as it generates multiple h1 tags on those pages Approved-by: Fredrik Thorsson Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -10,10 +10,7 @@ import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
|||||||
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
|
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
|
||||||
import type { StackableGridProps } from "../TempDesignSystem/Grids/Stackable/stackable"
|
import type { StackableGridProps } from "../TempDesignSystem/Grids/Stackable/stackable"
|
||||||
|
|
||||||
export default function CardsGrid({
|
export default function CardsGrid({ cards_grid }: CardsGridProps) {
|
||||||
cards_grid,
|
|
||||||
firstItem = false,
|
|
||||||
}: CardsGridProps) {
|
|
||||||
let columns: StackableGridProps["columns"]
|
let columns: StackableGridProps["columns"]
|
||||||
|
|
||||||
switch (cards_grid.layout) {
|
switch (cards_grid.layout) {
|
||||||
@@ -35,8 +32,8 @@ export default function CardsGrid({
|
|||||||
<SectionHeader
|
<SectionHeader
|
||||||
title={cards_grid.title}
|
title={cards_grid.title}
|
||||||
preamble={cards_grid.preamble}
|
preamble={cards_grid.preamble}
|
||||||
headingAs={firstItem ? "h3" : "h4"}
|
headingAs="h3"
|
||||||
headingLevel={firstItem ? "h1" : "h2"}
|
headingLevel="h2"
|
||||||
/>
|
/>
|
||||||
<Grids.Stackable columns={columns}>
|
<Grids.Stackable columns={columns}>
|
||||||
{cards_grid.cards.map((card, index) => {
|
{cards_grid.cards.map((card, index) => {
|
||||||
@@ -45,7 +42,7 @@ export default function CardsGrid({
|
|||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
theme={
|
theme={
|
||||||
card.backgroundImage ? "image" : cards_grid.theme ?? "one"
|
card.backgroundImage ? "image" : (cards_grid.theme ?? "one")
|
||||||
}
|
}
|
||||||
key={card.system.uid}
|
key={card.system.uid}
|
||||||
scriptedTopTitle={card.scripted_top_title}
|
scriptedTopTitle={card.scripted_top_title}
|
||||||
|
|||||||
@@ -7,13 +7,10 @@ import styles from "./howItWorks.module.css"
|
|||||||
|
|
||||||
import type { HowItWorksProps } from "@/types/components/blocks/dynamicContent"
|
import type { HowItWorksProps } from "@/types/components/blocks/dynamicContent"
|
||||||
|
|
||||||
export default async function HowItWorks({
|
export default async function HowItWorks({ dynamic_content }: HowItWorksProps) {
|
||||||
dynamic_content,
|
|
||||||
firstItem,
|
|
||||||
}: HowItWorksProps) {
|
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
return (
|
return (
|
||||||
<SectionWrapper dynamic_content={dynamic_content} firstItem={firstItem}>
|
<SectionWrapper dynamic_content={dynamic_content}>
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
<Title level="h3">{intl.formatMessage({ id: "How it works" })}</Title>
|
<Title level="h3">{intl.formatMessage({ id: "How it works" })}</Title>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -18,14 +18,13 @@ import type { LevelCardProps } from "@/types/components/overviewTable"
|
|||||||
|
|
||||||
export default async function LoyaltyLevels({
|
export default async function LoyaltyLevels({
|
||||||
dynamic_content,
|
dynamic_content,
|
||||||
firstItem,
|
|
||||||
}: LoyaltyLevelsProps) {
|
}: LoyaltyLevelsProps) {
|
||||||
const uniqueLevels = await serverClient().contentstack.rewards.all({
|
const uniqueLevels = await serverClient().contentstack.rewards.all({
|
||||||
unique: true,
|
unique: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionWrapper dynamic_content={dynamic_content} firstItem={firstItem}>
|
<SectionWrapper dynamic_content={dynamic_content}>
|
||||||
<section className={styles.cardContainer}>
|
<section className={styles.cardContainer}>
|
||||||
{uniqueLevels.map((level) => (
|
{uniqueLevels.map((level) => (
|
||||||
<LevelCard key={level.level_id} level={level} />
|
<LevelCard key={level.level_id} level={level} />
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type { OverviewTableProps } from "@/types/components/blocks/dynamicConten
|
|||||||
|
|
||||||
export default async function OverviewTable({
|
export default async function OverviewTable({
|
||||||
dynamic_content,
|
dynamic_content,
|
||||||
firstItem,
|
|
||||||
}: OverviewTableProps) {
|
}: OverviewTableProps) {
|
||||||
const [levels, membershipLevel] = await Promise.all([
|
const [levels, membershipLevel] = await Promise.all([
|
||||||
serverClient().contentstack.rewards.all(),
|
serverClient().contentstack.rewards.all(),
|
||||||
@@ -16,7 +15,7 @@ export default async function OverviewTable({
|
|||||||
])
|
])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionWrapper dynamic_content={dynamic_content} firstItem={firstItem}>
|
<SectionWrapper dynamic_content={dynamic_content}>
|
||||||
<OverviewTableClient
|
<OverviewTableClient
|
||||||
levels={levels}
|
levels={levels}
|
||||||
activeMembership={membershipLevel?.membershipLevel ?? null}
|
activeMembership={membershipLevel?.membershipLevel ?? null}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type { DynamicContentProps } from "@/types/components/blocks/dynamicConte
|
|||||||
export default function SectionWrapper({
|
export default function SectionWrapper({
|
||||||
children,
|
children,
|
||||||
dynamic_content,
|
dynamic_content,
|
||||||
firstItem,
|
|
||||||
}: React.PropsWithChildren<DynamicContentProps>) {
|
}: React.PropsWithChildren<DynamicContentProps>) {
|
||||||
const displayHeader = !!(
|
const displayHeader = !!(
|
||||||
dynamic_content.link ||
|
dynamic_content.link ||
|
||||||
@@ -21,8 +20,8 @@ export default function SectionWrapper({
|
|||||||
link={dynamic_content.link}
|
link={dynamic_content.link}
|
||||||
preamble={dynamic_content.subtitle}
|
preamble={dynamic_content.subtitle}
|
||||||
title={dynamic_content.title}
|
title={dynamic_content.title}
|
||||||
headingAs={firstItem ? "h3" : "h4"}
|
headingAs="h3"
|
||||||
headingLevel={firstItem ? "h1" : "h2"}
|
headingLevel="h2"
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function DynamicContent(props: DynamicContentProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DynamicContentBlocks(props: DynamicContentProps) {
|
function DynamicContentBlocks(props: DynamicContentProps) {
|
||||||
const { dynamic_content, firstItem } = props
|
const { dynamic_content } = props
|
||||||
switch (dynamic_content.component) {
|
switch (dynamic_content.component) {
|
||||||
case DynamicContentEnum.Blocks.components.current_benefits:
|
case DynamicContentEnum.Blocks.components.current_benefits:
|
||||||
return <CurrentRewardsBlock {...dynamic_content} />
|
return <CurrentRewardsBlock {...dynamic_content} />
|
||||||
@@ -44,29 +44,17 @@ function DynamicContentBlocks(props: DynamicContentProps) {
|
|||||||
<ExpiringPoints {...dynamic_content} />
|
<ExpiringPoints {...dynamic_content} />
|
||||||
)
|
)
|
||||||
case DynamicContentEnum.Blocks.components.how_it_works:
|
case DynamicContentEnum.Blocks.components.how_it_works:
|
||||||
return (
|
return <HowItWorks dynamic_content={dynamic_content} />
|
||||||
<HowItWorks dynamic_content={dynamic_content} firstItem={firstItem} />
|
|
||||||
)
|
|
||||||
case DynamicContentEnum.Blocks.components.jobylon_feed:
|
case DynamicContentEnum.Blocks.components.jobylon_feed:
|
||||||
return <JobylonFeed {...dynamic_content} />
|
return <JobylonFeed {...dynamic_content} />
|
||||||
case DynamicContentEnum.Blocks.components.loyalty_levels:
|
case DynamicContentEnum.Blocks.components.loyalty_levels:
|
||||||
return (
|
return <LoyaltyLevels dynamic_content={dynamic_content} />
|
||||||
<LoyaltyLevels
|
|
||||||
dynamic_content={dynamic_content}
|
|
||||||
firstItem={firstItem}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
case DynamicContentEnum.Blocks.components.membership_overview:
|
case DynamicContentEnum.Blocks.components.membership_overview:
|
||||||
return <Overview {...dynamic_content} />
|
return <Overview {...dynamic_content} />
|
||||||
case DynamicContentEnum.Blocks.components.next_benefits:
|
case DynamicContentEnum.Blocks.components.next_benefits:
|
||||||
return <NextLevelRewardsBlock {...dynamic_content} />
|
return <NextLevelRewardsBlock {...dynamic_content} />
|
||||||
case DynamicContentEnum.Blocks.components.overview_table:
|
case DynamicContentEnum.Blocks.components.overview_table:
|
||||||
return (
|
return <OverviewTable dynamic_content={dynamic_content} />
|
||||||
<OverviewTable
|
|
||||||
dynamic_content={dynamic_content}
|
|
||||||
firstItem={firstItem}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
case DynamicContentEnum.Blocks.components.points_overview:
|
case DynamicContentEnum.Blocks.components.points_overview:
|
||||||
return <PointsOverview {...dynamic_content} />
|
return <PointsOverview {...dynamic_content} />
|
||||||
case DynamicContentEnum.Blocks.components.previous_stays:
|
case DynamicContentEnum.Blocks.components.previous_stays:
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import styles from "./shortcutsList.module.css"
|
|||||||
import type { ShortcutsListProps } from "@/types/components/blocks/shortcuts"
|
import type { ShortcutsListProps } from "@/types/components/blocks/shortcuts"
|
||||||
|
|
||||||
export default function ShortcutsList({
|
export default function ShortcutsList({
|
||||||
firstItem = false,
|
|
||||||
shortcuts,
|
shortcuts,
|
||||||
subtitle,
|
subtitle,
|
||||||
title,
|
title,
|
||||||
@@ -39,8 +38,8 @@ export default function ShortcutsList({
|
|||||||
<SectionHeader
|
<SectionHeader
|
||||||
preamble={subtitle}
|
preamble={subtitle}
|
||||||
title={title}
|
title={title}
|
||||||
headingAs={firstItem ? "h3" : "h4"}
|
headingAs="h3"
|
||||||
headingLevel={firstItem ? "h1" : "h2"}
|
headingLevel="h2"
|
||||||
/>
|
/>
|
||||||
<section className={styles.section}>
|
<section className={styles.section}>
|
||||||
{columns.map(({ id, column }) => (
|
{columns.map(({ id, column }) => (
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { BlocksEnums } from "@/types/enums/blocks"
|
|||||||
|
|
||||||
export default function Blocks({ blocks }: BlocksProps) {
|
export default function Blocks({ blocks }: BlocksProps) {
|
||||||
return blocks.map(async (block, idx) => {
|
return blocks.map(async (block, idx) => {
|
||||||
const firstItem = idx === 0
|
|
||||||
switch (block.typename) {
|
switch (block.typename) {
|
||||||
case BlocksEnums.block.Accordion:
|
case BlocksEnums.block.Accordion:
|
||||||
return (
|
return (
|
||||||
@@ -35,7 +34,6 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
<CardsGrid
|
<CardsGrid
|
||||||
cards_grid={block.cards_grid}
|
cards_grid={block.cards_grid}
|
||||||
key={`${block.cards_grid.title}-${idx}`}
|
key={`${block.cards_grid.title}-${idx}`}
|
||||||
firstItem={firstItem}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
case BlocksEnums.block.Content:
|
case BlocksEnums.block.Content:
|
||||||
@@ -51,7 +49,6 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
return (
|
return (
|
||||||
<DynamicContent
|
<DynamicContent
|
||||||
dynamic_content={block.dynamic_content}
|
dynamic_content={block.dynamic_content}
|
||||||
firstItem={firstItem}
|
|
||||||
key={`${block.dynamic_content.title}-${idx}`}
|
key={`${block.dynamic_content.title}-${idx}`}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -87,7 +84,6 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
case BlocksEnums.block.Shortcuts:
|
case BlocksEnums.block.Shortcuts:
|
||||||
return (
|
return (
|
||||||
<ShortcutsList
|
<ShortcutsList
|
||||||
firstItem={firstItem}
|
|
||||||
key={`${block.shortcuts.title}-${idx}`}
|
key={`${block.shortcuts.title}-${idx}`}
|
||||||
shortcuts={block.shortcuts.shortcuts}
|
shortcuts={block.shortcuts.shortcuts}
|
||||||
subtitle={block.shortcuts.subtitle}
|
subtitle={block.shortcuts.subtitle}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { BlocksEnums } from "@/types/enums/blocks"
|
|||||||
|
|
||||||
export default function Blocks({ blocks }: BlocksProps) {
|
export default function Blocks({ blocks }: BlocksProps) {
|
||||||
return blocks.map((block, idx) => {
|
return blocks.map((block, idx) => {
|
||||||
const firstItem = idx === 0
|
|
||||||
switch (block.typename) {
|
switch (block.typename) {
|
||||||
case BlocksEnums.block.CardsGrid:
|
case BlocksEnums.block.CardsGrid:
|
||||||
return (
|
return (
|
||||||
@@ -45,7 +44,6 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
return (
|
return (
|
||||||
<DynamicContent
|
<DynamicContent
|
||||||
dynamic_content={dynamicContent}
|
dynamic_content={dynamicContent}
|
||||||
firstItem={firstItem}
|
|
||||||
key={`${block.dynamic_content.title}-${idx}`}
|
key={`${block.dynamic_content.title}-${idx}`}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -57,7 +55,6 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
return (
|
return (
|
||||||
<ShortcutsList
|
<ShortcutsList
|
||||||
key={`${block.shortcuts.title}-${idx}`}
|
key={`${block.shortcuts.title}-${idx}`}
|
||||||
firstItem={firstItem}
|
|
||||||
shortcuts={shortcuts}
|
shortcuts={shortcuts}
|
||||||
subtitle={block.shortcuts.subtitle}
|
subtitle={block.shortcuts.subtitle}
|
||||||
title={block.shortcuts.title}
|
title={block.shortcuts.title}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import type { CardsGrid } from "@/types/trpc/routers/contentstack/blocks"
|
import type { CardsGrid } from "@/types/trpc/routers/contentstack/blocks"
|
||||||
|
|
||||||
export interface CardsGridProps extends Pick<CardsGrid, "cards_grid"> {
|
export interface CardsGridProps extends Pick<CardsGrid, "cards_grid"> {}
|
||||||
firstItem?: boolean
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,20 +3,8 @@ import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
|
|||||||
interface PartialDynamicContent
|
interface PartialDynamicContent
|
||||||
extends Pick<DynamicContent, "dynamic_content"> {}
|
extends Pick<DynamicContent, "dynamic_content"> {}
|
||||||
|
|
||||||
export interface DynamicContentProps extends PartialDynamicContent {
|
export interface DynamicContentProps extends PartialDynamicContent {}
|
||||||
firstItem: boolean
|
export interface HowItWorksProps extends PartialDynamicContent {}
|
||||||
}
|
export interface LoyaltyLevelsProps extends PartialDynamicContent {}
|
||||||
|
export interface OverviewTableProps extends PartialDynamicContent {}
|
||||||
export interface HowItWorksProps extends PartialDynamicContent {
|
|
||||||
firstItem: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoyaltyLevelsProps extends PartialDynamicContent {
|
|
||||||
firstItem: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OverviewTableProps extends PartialDynamicContent {
|
|
||||||
firstItem: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SignupFormWrapperProps extends PartialDynamicContent {}
|
export interface SignupFormWrapperProps extends PartialDynamicContent {}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import type { Shortcut } from "@/types/trpc/routers/contentstack/blocks"
|
import type { Shortcut } from "@/types/trpc/routers/contentstack/blocks"
|
||||||
|
|
||||||
export interface ShortcutsListProps extends Shortcut {
|
export interface ShortcutsListProps extends Shortcut {}
|
||||||
firstItem?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ShortcutsListItemsProps = {
|
export type ShortcutsListItemsProps = {
|
||||||
className?: string
|
className?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user