33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import JsonToHtml from "@/components/JsonToHtml"
|
|
|
|
import JoinLoyaltyContact from "./JoinLoyalty"
|
|
|
|
import styles from "./sidebar.module.css"
|
|
|
|
import { SidebarTypenameEnum } from "@/types/components/loyalty/enums"
|
|
import { SidebarProps } from "@/types/components/loyalty/sidebar"
|
|
|
|
export default function SidebarLoyalty({ blocks }: SidebarProps) {
|
|
return (
|
|
<aside>
|
|
{blocks.map((block) => {
|
|
switch (block.__typename) {
|
|
case SidebarTypenameEnum.LoyaltyPageSidebarContent:
|
|
return (
|
|
<section className={styles.content}>
|
|
<JsonToHtml
|
|
embeds={block.content.content.embedded_itemsConnection.edges}
|
|
nodes={block.content.content.json.children}
|
|
/>
|
|
</section>
|
|
)
|
|
case SidebarTypenameEnum.LoyaltyPageSidebarJoinLoyaltyContact:
|
|
return <JoinLoyaltyContact block={block.join_loyalty_contact} />
|
|
default:
|
|
return null
|
|
}
|
|
})}
|
|
</aside>
|
|
)
|
|
}
|