Files
Joshen Lim 75e1717a02 Remove barrel files part 02 (#39956)
* Remove barrel files part 02

* Clean up
2025-10-30 23:50:14 +08:00

59 lines
1.9 KiB
TypeScript

import { Badge, Menu } from 'ui'
import type { ProductMenuGroup } from './ProductMenu.types'
import ProductMenuItem from './ProductMenuItem'
interface ProductMenuProps {
page?: string
menu: ProductMenuGroup[]
}
export const ProductMenu = ({ page, menu }: ProductMenuProps) => {
return (
<div className="flex flex-col space-y-8">
<Menu type="pills">
{menu.map((group, idx) => (
<div key={group.key || group.title}>
<div className="my-6 space-y-8">
<div className="mx-3">
<Menu.Group
title={
group.title ? (
<div className="flex flex-col space-y-2 uppercase font-mono">
<span>{group.title}</span>
{group.isPreview && <Badge variant="warning">Not production ready</Badge>}
</div>
) : null
}
/>
<div>
{group.items.map((item) => {
const isActive = !!item.pages
? item.pages.includes(page ?? '')
: page === item.key
return (
<ProductMenuItem
key={item.key}
url={item.url}
name={item.name}
icon={item.icon}
rightIcon={item.rightIcon}
isActive={isActive}
isExternal={item.isExternal}
target={item.isExternal ? '_blank' : '_self'}
label={item.label}
/>
)
})}
</div>
</div>
</div>
{idx !== menu.length - 1 && <div className="h-px w-full bg-border-overlay" />}
</div>
))}
</Menu>
</div>
)
}