'use client'
import React, { ReactNode } from 'react'
import Link from 'next/link'

import { usePathname } from 'next/navigation'

export default function Title({headerImage}: {headerImage: ReactNode}) {
  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">
        {headerImage}
      </div>
    </header>
  )
}
