46 lines
1.3 KiB
TypeScript
46 lines
1.3 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"
|
|
import { LangParams } from "@/types/params"
|
|
|
|
export default function SidebarLoyalty({
|
|
blocks,
|
|
lang,
|
|
}: SidebarProps & LangParams) {
|
|
return (
|
|
<aside className={styles.aside}>
|
|
{blocks.map((block, idx) => {
|
|
switch (block.__typename) {
|
|
case SidebarTypenameEnum.LoyaltyPageSidebarContent:
|
|
return (
|
|
<section
|
|
className={styles.content}
|
|
key={`${block.__typename}-${idx}`}
|
|
>
|
|
<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}
|
|
lang={lang}
|
|
key={`${block.join_loyalty_contact.title}-${idx}`}
|
|
/>
|
|
)
|
|
default:
|
|
return null
|
|
}
|
|
})}
|
|
</aside>
|
|
)
|
|
}
|