import { Document } from "asciidoctor";
import { DateTime } from "luxon";

type Props = {
    article: Document;
    date: DateTime;
    body: string;
    asset(path: string): string;
};

export default ({ asset, article, date, body }: Props) => (
    <>
        <nav>
            <a href="/" title="Back to home page">
                <img src={asset("avatar.avif")} alt="Adædra's avatar" />
                Adædra
            </a>
        </nav>
        <article>
            <header class="article-header">
                {date.toLocaleString(DateTime.DATE_FULL)}
                <h1 dangerouslySetInnerHTML={{ __html: article.getDocumentTitle() as string }} />
            </header>
            <a name="content" />
            <main dangerouslySetInnerHTML={{ __html: body }} />
        </article>
    </>
);
