mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 23:14:28 +08:00
88 lines
3.5 KiB
JavaScript
88 lines
3.5 KiB
JavaScript
import React from 'react'
|
|
import AuthUser from '../../hooks/authUser'
|
|
import { Disclosure } from '@headlessui/react'
|
|
import { MenuIcon, XIcon } from '@heroicons/react/outline'
|
|
import MenuLogado from './menuLogado'
|
|
import MenuNotLogado from './menuNotLogado'
|
|
import Navigation from './navigation'
|
|
import classNames from '../../utils/classsesNames'
|
|
|
|
export default function Header() {
|
|
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 ? (
|
|
<XIcon className="block h-6 w-6" aria-hidden="true" />
|
|
) : (
|
|
<MenuIcon 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 text-white">
|
|
<img
|
|
className="h-8 w-auto"
|
|
src="https://supabase.com/images/logo-dark.png"
|
|
alt="supabase"
|
|
/>
|
|
</div>
|
|
<div className="hidden sm:block sm:ml-6">
|
|
<div className="flex space-x-4">
|
|
{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',
|
|
'px-3 py-2 rounded-md text-sm font-medium'
|
|
)}
|
|
aria-current={item.current ? 'page' : undefined}
|
|
>
|
|
{item.name}
|
|
</a>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
|
|
{/** notifications */}
|
|
|
|
{AuthUser() ? <MenuLogado /> : <MenuNotLogado />}
|
|
</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>
|
|
)
|
|
}
|