33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import styles from "./layout.module.css";
|
|
|
|
const productName = "Lincodex";
|
|
|
|
type PageProps = {
|
|
/** Text of the page's single h1 and of the document title. */
|
|
title: string;
|
|
/** Short context line above the heading, for example the cabinet name. */
|
|
eyebrow?: string | undefined;
|
|
lead?: ReactNode;
|
|
width?: "narrow" | "wide";
|
|
children?: ReactNode;
|
|
};
|
|
|
|
/**
|
|
* Page content inside a shell's main landmark. It owns the only h1 of the
|
|
* page and sets the document title (React hoists <title> into <head>).
|
|
*/
|
|
export function Page({ title, eyebrow, lead, width = "narrow", children }: PageProps) {
|
|
return (
|
|
<div className={`${styles.page} ${styles[width]}`}>
|
|
<title>{`${title} - ${productName}`}</title>
|
|
<header className={styles["page-header"]}>
|
|
{eyebrow ? <p className={styles.eyebrow}>{eyebrow}</p> : null}
|
|
<h1 className={styles.title}>{title}</h1>
|
|
{lead ? <div className={styles.lead}>{lead}</div> : null}
|
|
</header>
|
|
{children ? <div className={styles["page-body"]}>{children}</div> : null}
|
|
</div>
|
|
);
|
|
}
|