Setup Mobile Menu Sidebar

This commit is contained in:
Nine
2021-10-20 18:08:48 +02:00
parent e3471db3eb
commit b34fdc362c
7 changed files with 100 additions and 10 deletions

View File

@@ -0,0 +1,38 @@
import cn from 'classnames'
import Link from 'next/link'
import { FC } from 'react'
import { useUI } from '@components/ui/context'
import SidebarLayout from '@components/common/SidebarLayout'
interface Link {
href: string
label: string
}
interface MenuProps {
links?: Link[]
}
const MenuSidebarView: FC<MenuProps> = (props) => {
const { closeSidebar } = useUI()
const handleClose = () => closeSidebar()
console.log(props.links)
return (
<SidebarLayout handleClose={handleClose}>
<div className="px-4 sm:px-6 flex-1">
<ul>
{props.links?.map((l: any) => (
<li key={l.href}>
<Link href={l.href}>
<a>{l.label}</a>
</Link>
</li>
))}
</ul>
</div>
</SidebarLayout>
)
}
export default MenuSidebarView

View File

@@ -0,0 +1 @@
export { default } from './MenuSidebarView'