+ Contents
{headings.map((h: Heading) => {
return (
- -
+
-
{h.text}
);
@@ -23,23 +23,12 @@ const Metadata = ({
label?: string;
children: preact.ComponentChildren;
}) => (
-
+
{label &&
{label} }
-
{children}
+
{children}
);
-interface HeaderProps {
- url: URL;
- lang: Intl.LocalesArgument;
- title?: string;
- description?: string;
- datePublished?: Date;
- dateUpdated?: Date;
- tags?: string[];
- compact?: boolean;
-}
-
const Header = ({
title,
description,
@@ -48,8 +37,15 @@ const Header = ({
dateUpdated,
tags,
lang,
- compact,
-}: HeaderProps) => {
+}: {
+ url: URL;
+ lang: Intl.LocalesArgument;
+ title?: string;
+ description?: string;
+ datePublished?: Date;
+ dateUpdated?: Date;
+ tags?: string[];
+}) => {
const dateFormat: Intl.DateTimeFormatOptions = {
year: "numeric",
month: "short",
@@ -57,20 +53,15 @@ const Header = ({
};
return (
-
- {title}
-
- {description && {description}
}
+
+ {title}
+ {description && {description}
}
{(datePublished || dateUpdated || tags) && (
-
+
{datePublished && (
-
+
@@ -78,7 +69,7 @@ const Header = ({
)}
{dateUpdated && (
-
+
@@ -101,14 +92,15 @@ const Header = ({
);
};
-interface ArticleProps {
+const Article = ({
+ page,
+ children,
+ lang,
+}: {
page: Page;
lang: Intl.LocalesArgument;
children?: preact.ComponentChildren;
- compact?: boolean;
-}
-
-const Article = ({ page, children, lang, compact }: ArticleProps) => {
+}) => {
const {
showHeader,
url,
@@ -122,30 +114,50 @@ const Article = ({ page, children, lang, compact }: ArticleProps) => {
html,
} = page;
- return (
-
- {showHeader && (
-
- )}
+ return html
+ ? (
+
+ {showHeader && (
+
+ )}
- {!compact && showToc && headings?.some((h) => h.level >= 2) && (
- h.level <= 2)} />
- )}
+ {showToc && headings?.some((h) => h.level >= 2) && (
+ h.level <= 2)} />
+ )}
- {html && }
+ {html && (
+
+ )}
- {children}
-
- );
+ {children}
+
+ )
+ : (
+ showHeader
+ ? (
+
+ )
+ : null
+ );
};
export default Article;
diff --git a/components/Body.tsx b/components/Body.tsx
index e1fb0e1..cdbbf9c 100644
--- a/components/Body.tsx
+++ b/components/Body.tsx
@@ -1,13 +1,9 @@
-/** @jsxImportSource npm:preact */
-
-import Article from "./Article.tsx";
-import Footer from "./Footer.tsx";
-import Header from "./Header.tsx";
-import IndexList from "./IndexList.tsx";
-import IndexLog from "./IndexLog.tsx";
-import IndexGrid from "./IndexGrid.tsx";
+/** @jsxImportSource https://esm.sh/preact */
+import { IndexGrid, IndexList, IndexLog } from "./lists.tsx";
import { Crumb, Page } from "../types.d.ts";
+import { Footer, Header } from "./chrome.tsx";
+import Article from "./article.tsx";
interface BodyProps {
page: Page;
@@ -51,25 +47,14 @@ const Body = ({
author,
lang,
}: BodyProps) => (
-
+
-