add dark
This commit is contained in:
		
							
								
								
									
										132
									
								
								src/components/Header_darkbg.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								src/components/Header_darkbg.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,132 @@
 | 
			
		||||
'use client'
 | 
			
		||||
 | 
			
		||||
import Link from 'next/link'
 | 
			
		||||
import {
 | 
			
		||||
  Popover,
 | 
			
		||||
  PopoverButton,
 | 
			
		||||
  PopoverBackdrop,
 | 
			
		||||
  PopoverPanel,
 | 
			
		||||
} from '@headlessui/react'
 | 
			
		||||
import clsx from 'clsx'
 | 
			
		||||
 | 
			
		||||
import { Button } from '@/components/Button'
 | 
			
		||||
import { Container } from '@/components/Container'
 | 
			
		||||
import { Logo_darkbg } from '@/components/Logo_darkbg'
 | 
			
		||||
function NavLinkDark({
 | 
			
		||||
  href,
 | 
			
		||||
  children,
 | 
			
		||||
}: {
 | 
			
		||||
  href: string
 | 
			
		||||
  children: React.ReactNode
 | 
			
		||||
}) {
 | 
			
		||||
  return (
 | 
			
		||||
    <Link
 | 
			
		||||
      href={href}
 | 
			
		||||
      className="inline-block rounded-lg px-2 py-1 text-base text-white hover:bg-white/10 hover:text-white"
 | 
			
		||||
    >
 | 
			
		||||
      {children}
 | 
			
		||||
    </Link>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function MobileNavLink({
 | 
			
		||||
  href,
 | 
			
		||||
  children,
 | 
			
		||||
}: {
 | 
			
		||||
  href: string
 | 
			
		||||
  children: React.ReactNode
 | 
			
		||||
}) {
 | 
			
		||||
  return (
 | 
			
		||||
    <PopoverButton as={Link} href={href} className="block w-full p-2 text-white">
 | 
			
		||||
      {children}
 | 
			
		||||
    </PopoverButton>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function MobileNavIcon({ open }: { open: boolean }) {
 | 
			
		||||
  return (
 | 
			
		||||
    <svg
 | 
			
		||||
      aria-hidden="true"
 | 
			
		||||
      className="h-3.5 w-3.5 overflow-visible stroke-white"
 | 
			
		||||
      fill="none"
 | 
			
		||||
      strokeWidth={2}
 | 
			
		||||
      strokeLinecap="round"
 | 
			
		||||
    >
 | 
			
		||||
      <path
 | 
			
		||||
        d="M0 1H14M0 7H14M0 13H14"
 | 
			
		||||
        className={clsx(
 | 
			
		||||
          'origin-center transition',
 | 
			
		||||
          open && 'scale-90 opacity-0',
 | 
			
		||||
        )}
 | 
			
		||||
      />
 | 
			
		||||
      <path
 | 
			
		||||
        d="M2 2L12 12M12 2L2 12"
 | 
			
		||||
        className={clsx(
 | 
			
		||||
          'origin-center transition',
 | 
			
		||||
          !open && 'scale-90 opacity-0',
 | 
			
		||||
        )}
 | 
			
		||||
      />
 | 
			
		||||
    </svg>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function MobileNavigation() {
 | 
			
		||||
  return (
 | 
			
		||||
    <Popover>
 | 
			
		||||
      <PopoverButton
 | 
			
		||||
        className="relative z-10 flex h-8 w-8 items-center justify-center focus:not-data-focus:outline-hidden"
 | 
			
		||||
        aria-label="Toggle Navigation"
 | 
			
		||||
      >
 | 
			
		||||
        {({ open }) => <MobileNavIcon open={open} />}
 | 
			
		||||
      </PopoverButton>
 | 
			
		||||
      <PopoverBackdrop
 | 
			
		||||
        transition
 | 
			
		||||
        className="fixed inset-0 bg-black/50 duration-150 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in"
 | 
			
		||||
      />
 | 
			
		||||
      <PopoverPanel
 | 
			
		||||
        transition
 | 
			
		||||
        className="absolute inset-x-0 top-full mt-4 flex origin-top flex-col rounded-2xl bg-black p-4 text-lg tracking-tight text-white shadow-xl ring-1 ring-white/10 data-closed:scale-95 data-closed:opacity-0 data-enter:duration-150 data-enter:ease-out data-leave:duration-100 data-leave:ease-in"
 | 
			
		||||
      >
 | 
			
		||||
        <MobileNavLink href="/about">About</MobileNavLink>
 | 
			
		||||
        <MobileNavLink href="/ventures">Ventures</MobileNavLink>
 | 
			
		||||
        <MobileNavLink href="/News">News</MobileNavLink>
 | 
			
		||||
        <hr className="m-2 border-white/20" />
 | 
			
		||||
        <MobileNavLink href="/contact">Contact Us</MobileNavLink>
 | 
			
		||||
      </PopoverPanel>
 | 
			
		||||
    </Popover>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function Header_darkbg() {
 | 
			
		||||
  return (
 | 
			
		||||
    <header className="py-5 bg-black">
 | 
			
		||||
      <Container>
 | 
			
		||||
        <nav className="relative z-50 flex justify-between">
 | 
			
		||||
          <div className="flex items-center md:gap-x-12">
 | 
			
		||||
            <Link href="#" aria-label="Home">
 | 
			
		||||
              <Logo_darkbg className="h-6 w-auto lg:h-6 md:h-8" />
 | 
			
		||||
            </Link>
 | 
			
		||||
            <div className="hidden md:flex md:gap-x-6">
 | 
			
		||||
              <NavLinkDark href="/about">About</NavLinkDark>
 | 
			
		||||
              <NavLinkDark href="/ventures">Ventures</NavLinkDark>
 | 
			
		||||
              <NavLinkDark href="/people">People</NavLinkDark>
 | 
			
		||||
              <NavLinkDark href="/news">News</NavLinkDark>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div className="flex items-center gap-x-5 md:gap-x-8">
 | 
			
		||||
            <div className="hidden md:block">
 | 
			
		||||
              <Button href="/contact" color="white">
 | 
			
		||||
                <span>
 | 
			
		||||
                  Contact Us
 | 
			
		||||
                </span>
 | 
			
		||||
              </Button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div className="-mr-1 md:hidden">
 | 
			
		||||
              <MobileNavigation />
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </nav>
 | 
			
		||||
      </Container>
 | 
			
		||||
    </header>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user