import sass from "https://deno.land/x/denosass@1.0.6/mod.ts";
import { Props } from "../types.d.ts";
import { h } from "../jsx.ts";

interface BaseHeaderProps extends Props {
    id?: string;
    entries: {
        name: string;
        href: string;
        element?: unknown;
    }[];
    currentHref: string;
}

export default (props: BaseHeaderProps) => (
    <header id={props.id} class="header">
        {props.entries
            .map((entry) =>
                entry.element ? (
                    entry.element
                ) : entry.href !== props.currentHref ? (
                    <a href={entry.href}>{entry.name}</a>
                ) : (
                    <p id="selected-header-element">{entry.name}</p>
                )
            )
            .join("")}
    </header>
);
