feat(SW-66, SW-348): search functionality and ui
This commit is contained in:
49
components/Sidebar/index.tsx
Normal file
49
components/Sidebar/index.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import JsonToHtml from "@/components/JsonToHtml"
|
||||
|
||||
import JoinLoyaltyContact from "./JoinLoyalty"
|
||||
import MyPagesNavigation from "./MyPagesNavigation"
|
||||
|
||||
import styles from "./sidebar.module.css"
|
||||
|
||||
import type { SidebarProps } from "@/types/components/sidebar"
|
||||
import { DynamicContentEnum } from "@/types/enums/dynamicContent"
|
||||
import { SidebarEnums } from "@/types/enums/sidebar"
|
||||
|
||||
export default function Sidebar({ blocks }: SidebarProps) {
|
||||
return (
|
||||
<aside className={styles.aside}>
|
||||
{blocks.map((block, idx) => {
|
||||
switch (block.typename) {
|
||||
case SidebarEnums.blocks.Content:
|
||||
return (
|
||||
<section
|
||||
className={styles.content}
|
||||
key={`${block.typename}-${idx}`}
|
||||
>
|
||||
<JsonToHtml
|
||||
embeds={block.content.embedded_itemsConnection.edges}
|
||||
nodes={block.content.json.children}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
case SidebarEnums.blocks.DynamicContent:
|
||||
switch (block.dynamic_content.component) {
|
||||
case DynamicContentEnum.Sidebar.components.my_pages_navigation:
|
||||
return <MyPagesNavigation key={`${block.typename}-${idx}`} />
|
||||
default:
|
||||
return null
|
||||
}
|
||||
case SidebarEnums.blocks.JoinLoyaltyContact:
|
||||
return (
|
||||
<JoinLoyaltyContact
|
||||
block={block.join_loyalty_contact}
|
||||
key={`${block.typename}-${idx}`}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})}
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user