You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
3.2 KiB
84 lines
3.2 KiB
import Link from 'next/link';
|
|
import React from 'react';
|
|
import { Disclosure} from '@headlessui/react'
|
|
import { MenuIcon, XIcon } from '@heroicons/react/outline'
|
|
|
|
const navigation = [
|
|
{ name: 'Главная', href: '/', current: true },
|
|
{ name: 'Правила', href: '/posts/[slug]', as:'/posts/regulations', current: false },
|
|
{ name: 'Регистрация', href: '/registration', current: false },
|
|
{ name: 'О нас', href: '/about', current: false },
|
|
]
|
|
|
|
|
|
|
|
function classNames(...classes) {
|
|
return classes.filter(Boolean).join(' ')
|
|
}
|
|
|
|
|
|
|
|
const Navigation = (): JSX.Element => {
|
|
return (
|
|
<Disclosure as="nav" className="bg-gray-800">
|
|
{({ open }) => (
|
|
<>
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div className="flex items-center justify-between h-16">
|
|
<div className="flex items-center md:hidden">
|
|
{/* Mobile menu button*/}
|
|
<Disclosure.Button className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white">
|
|
<span className="sr-only">Open main menu</span>
|
|
{open ? (
|
|
<XIcon className="block h-6 w-6" aria-hidden="true" />
|
|
) : (
|
|
<MenuIcon className="block h-6 w-6" aria-hidden="false" />
|
|
)}
|
|
</Disclosure.Button>
|
|
</div>
|
|
<div className="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
|
|
<div className="sm:hidden sm:block ml-6">
|
|
<div className="flex space-x-4">
|
|
{navigation.map((item) => (
|
|
<Link as={item.as} href={item.href} key={item.name}>
|
|
<a
|
|
className={classNames(
|
|
item.current ? 'bg-gray-900 text-white' : 'text-gray-900 hover:bg-gray-700 hover:text-white',
|
|
'px-3 py-2 rounded-md text-sm font-medium'
|
|
)}
|
|
aria-current={item.current ? 'page' : undefined}
|
|
>
|
|
{item.name}
|
|
</a>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<Disclosure.Panel className="">
|
|
<div className="px-2 pt-2 pb-3 space-y-1">
|
|
{navigation.map((item) => (
|
|
<Link as={item.as} href={item.href} key={item.name}>
|
|
<Disclosure.Button
|
|
className={classNames(
|
|
item.current ? 'bg-gray-900 text-white' : 'text-gray-900 hover:bg-gray-900 hover:text-white',
|
|
'block px-3 py-2 rounded-md text-base font-medium'
|
|
)}
|
|
aria-current={item.current ? 'page' : undefined}
|
|
>
|
|
{item.name}
|
|
</Disclosure.Button>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</Disclosure.Panel>
|
|
</>
|
|
)}
|
|
</Disclosure>
|
|
);
|
|
};
|
|
|
|
export default Navigation;
|
|
|