import React from 'react'
import Link from 'next/link'
import Image from 'components/Image'

import { usePathname } from 'next/navigation'

const header = 'images/aurora-1197753.jpg'

export default function Title() {
  const pathname = usePathname()

  const isHomepage = pathname === '/'

  return (
    <header className={isHomepage ? 'homepage' : undefined}>
      {isHomepage
        ? <h1 className="siteTitle">tempest.dev</h1>
        : <Link href="/" className="siteTitle">tempest.dev</Link>
      }
      <nav>
        <Link href="/about">about</Link>
        <Link href="/contact">contact</Link>
        <Link target="blank" href="https://git.tempest.dev/ashe/tempest.dev">code</Link>
      </nav>
      <div className="headerBackground">
        <Image
          src={header}
          alt=""
          role="presentation"
          width={[2560,1920,1280,800,600]}
          sizes={`
            (max-width: 2560) 100vw,
            (max-width: 1920) 100vw,
            (max-width: 1280) 100vw,
            (max-width: 800) 100vw,
            (max-width: 600) 100vw,
          `}
        />
      </div>
    </header>
  )
}
