refactor: zod validation and pr comments
This commit is contained in:
@@ -7,20 +7,26 @@ import styles from "./sidebar.module.css"
|
||||
import { SidebarProps } from "@/types/components/loyalty/sidebar"
|
||||
import { SidebarTypenameEnum } from "@/types/requests/loyaltyPage"
|
||||
|
||||
export default function SidebarLoyalty({ block }: SidebarProps) {
|
||||
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
|
||||
}
|
||||
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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user