mirror of
https://github.com/vercel/commerce.git
synced 2025-05-16 14:36:59 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import Link from 'next/link'
|
|
import s from './MenuSidebarView.module.css'
|
|
import { useUI } from '@components/ui/context'
|
|
import SidebarLayout from '@components/common/SidebarLayout'
|
|
import type { Link as LinkProps } from './index'
|
|
import { useRouter } from 'next/router'
|
|
|
|
export default function MenuSidebarView({
|
|
links = [],
|
|
}: {
|
|
links?: LinkProps[]
|
|
}) {
|
|
const { closeSidebar } = useUI()
|
|
const { locale = 'it' } = useRouter()
|
|
return (
|
|
<SidebarLayout handleClose={() => closeSidebar()}>
|
|
<div className={s.root}>
|
|
<nav>
|
|
<ul>
|
|
<li className={s.item} onClick={() => closeSidebar()}>
|
|
<Link href="/search">
|
|
<a>{locale == 'it' ? 'Vetrina' : 'Shop'}</a>
|
|
</Link>
|
|
</li>
|
|
{links.map((l: any) => (
|
|
<li
|
|
key={l.href}
|
|
className={s.item}
|
|
onClick={() => closeSidebar()}
|
|
>
|
|
<Link href={l.href}>
|
|
<a>{l.label}</a>
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</SidebarLayout>
|
|
)
|
|
}
|
|
|
|
MenuSidebarView
|