feat(SW-285): Ship support for ContentPageBlocksContent
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import JsonToHtml from "@/components/JsonToHtml"
|
||||
|
||||
// import DynamicContentBlock from "@/components/Loyalty/Blocks/DynamicContent"
|
||||
// import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
|
||||
// import CardsGrid from "./CardsGrid"
|
||||
import type { BlocksProps } from "@/types/components/content/blocks"
|
||||
import { ContentBlocksTypenameEnum } from "@/types/components/content/enums"
|
||||
|
||||
export function Blocks({ blocks }: BlocksProps) {
|
||||
return blocks.map((block, idx) => {
|
||||
const firstItem = idx === 0
|
||||
switch (block.__typename) {
|
||||
case ContentBlocksTypenameEnum.ContentPageBlocksContent:
|
||||
return (
|
||||
<section key={`${block.__typename}-${idx}`}>
|
||||
<JsonToHtml
|
||||
nodes={block.content.content.json.children}
|
||||
embeds={block.content.content.embedded_itemsConnection.edges}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { Blocks } from "@/components/Content/Blocks"
|
||||
import Hero from "@/components/Hero"
|
||||
import Intro from "@/components/Intro"
|
||||
import Preamble from "@/components/TempDesignSystem/Text/Preamble"
|
||||
@@ -36,6 +37,7 @@ export default async function ContentPage() {
|
||||
src={heroImage.url}
|
||||
/>
|
||||
) : null}
|
||||
{contentPage.blocks ? <Blocks blocks={contentPage.blocks} /> : null}
|
||||
</div>
|
||||
</main>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user