summaryrefslogtreecommitdiffstats
path: root/src/server/template/Page.ts
blob: ec76e9779d5f3a12d7f96805d8671c89ab02eb2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Base, { BaseI, content } from "./Base.js"
import h from "./header.js"
import { article } from "./html.js"
import { c, node } from "./vdom.js"

export interface PageI<T extends node = node> extends BaseI<T> {
	title: string
}

export default function Page<Type extends PageI>(data: Type): ReturnType<typeof Base<Type>> {
	const arg = {
		...data,
		content() {
			var { title } = this
			return c(article, {},
				c(h, { level: 1 }, title),
				c(content, { data })
			)
		}

	}
	return Base(arg)
}