import { h, type FunctionComponent } from 'preact'
import s from './header.module.scss'

import type { Route } from '../../../shared/types.ts'

const Header: FunctionComponent<{ routes: Route[] }> = ({ routes }) => (
  <header>
    <h1>BRF Tegeltrasten</h1>
    <nav className={s.nav}>
      <ul>
        {routes.map((route) =>
          route.nav !== false ? (
            <li key={route.path}>
              <a href={route.path}>{route.title}</a>
            </li>
          ) : null,
        )}
      </ul>
    </nav>
  </header>
)

export default Header
