97 lines
3.7 KiB
JavaScript
97 lines
3.7 KiB
JavaScript
import { Fragment } from "react";
|
|
import { Disclosure, Menu, Transition } from "@headlessui/react";
|
|
import { siteConfig } from "config/siteConfig";
|
|
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'
|
|
|
|
import Link from "next/link";
|
|
import GitHubButton from "react-next-github-btn";
|
|
|
|
const navigation = siteConfig.navLinks;
|
|
|
|
function classNames(...classes) {
|
|
return classes.filter(Boolean).join(" ");
|
|
}
|
|
|
|
export default function Nav() {
|
|
return (
|
|
<Disclosure as="nav" className="bg-gray-800">
|
|
{({ open }) => (
|
|
<>
|
|
<div className="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
|
|
<div className="relative flex items-center justify-between h-16">
|
|
<div className="absolute inset-y-0 left-0 flex items-center sm: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 ? (
|
|
<Bars3Icon className="block h-6 w-6" aria-hidden="true" />
|
|
) : (
|
|
<XMarkIcon className="block h-6 w-6" aria-hidden="true" />
|
|
)}
|
|
</Disclosure.Button>
|
|
</div>
|
|
<div className="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
|
|
<div className="flex-shrink-0 flex items-center">
|
|
<Link href="/" className="text-white">
|
|
Portal.JS
|
|
</Link>
|
|
</div>
|
|
<div className="hidden sm:block sm:ml-6">
|
|
<div className="flex space-x-4">
|
|
{navigation.map((item) => (
|
|
<Link
|
|
href={item.href}
|
|
key={item.name}
|
|
className={classNames(
|
|
item.current
|
|
? "bg-gray-900 text-white"
|
|
: "text-gray-300 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}
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="mt-2 justify-end">
|
|
<GitHubButton
|
|
href="https://github.com/datopian/portal.js"
|
|
data-color-scheme="no-preference: light; light: light; dark: dark;"
|
|
data-size="large"
|
|
data-show-count="true"
|
|
aria-label="Star datopian/portal.js on GitHub"
|
|
>
|
|
Stars
|
|
</GitHubButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<Disclosure.Panel className="sm:hidden">
|
|
<div className="px-2 pt-2 pb-3 space-y-1">
|
|
{navigation.map((item) => (
|
|
<a
|
|
key={item.name}
|
|
href={item.href}
|
|
className={classNames(
|
|
item.current
|
|
? "bg-gray-900 text-white"
|
|
: "text-gray-300 hover:bg-gray-700 hover:text-white",
|
|
"block px-3 py-2 rounded-md text-base font-medium"
|
|
)}
|
|
aria-current={item.current ? "page" : undefined}
|
|
>
|
|
{item.name}
|
|
</a>
|
|
))}
|
|
</div>
|
|
</Disclosure.Panel>
|
|
</>
|
|
)}
|
|
</Disclosure>
|
|
);
|
|
}
|