feat(SW-66, SW-348): search functionality and ui
This commit is contained in:
64
components/Blocks/CardsGrid.tsx
Normal file
64
components/Blocks/CardsGrid.tsx
Normal file
@@ -0,0 +1,64 @@
|
||||
import SectionContainer from "@/components/Section/Container"
|
||||
import SectionHeader from "@/components/Section/Header"
|
||||
import Card from "@/components/TempDesignSystem/Card"
|
||||
import ContentCard from "@/components/TempDesignSystem/ContentCard"
|
||||
import Grids from "@/components/TempDesignSystem/Grids"
|
||||
import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard"
|
||||
|
||||
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
||||
import { CardsGridEnum } from "@/types/enums/cardsGrid"
|
||||
|
||||
export default function CardsGrid({
|
||||
cards_grid,
|
||||
firstItem = false,
|
||||
}: CardsGridProps) {
|
||||
return (
|
||||
<SectionContainer>
|
||||
<SectionHeader
|
||||
title={cards_grid.title}
|
||||
preamble={cards_grid.preamble}
|
||||
topTitle={firstItem}
|
||||
/>
|
||||
<Grids.Stackable>
|
||||
{cards_grid.cards.map((card) => {
|
||||
switch (card.__typename) {
|
||||
case CardsGridEnum.cards.Card: {
|
||||
return card.isContentCard ? (
|
||||
<ContentCard
|
||||
key={card.system.uid}
|
||||
description={card.body_text}
|
||||
backgroundImage={card.backgroundImage}
|
||||
primaryButton={card.primaryButton}
|
||||
secondaryButton={card.secondaryButton}
|
||||
sidePeekButton={card.sidePeekButton}
|
||||
style="default"
|
||||
title={card.heading}
|
||||
/>
|
||||
) : (
|
||||
<Card
|
||||
key={card.system.uid}
|
||||
bodyText={card.body_text}
|
||||
heading={card.heading}
|
||||
primaryButton={card.primaryButton}
|
||||
secondaryButton={card.secondaryButton}
|
||||
scriptedTopTitle={card.scripted_top_title}
|
||||
theme={cards_grid.theme || "one"}
|
||||
/>
|
||||
)
|
||||
}
|
||||
case CardsGridEnum.cards.LoyaltyCard:
|
||||
return (
|
||||
<LoyaltyCard
|
||||
key={card.system.uid}
|
||||
bodyText={card.body_text}
|
||||
heading={card.heading}
|
||||
image={card.image}
|
||||
link={card.link}
|
||||
/>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</Grids.Stackable>
|
||||
</SectionContainer>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user