import html from '../lib/html.ts'
interface Options {
content: string
css: string[]
head: Promise<{
title?: string
tags?: {
type: string
attributes: Record
}[]
}>
preload?: string[]
script: string
state: Promise>
}
export default ({ content, css, head, preload, script, state }: Options) => html`
${css?.map((href) => ``)}
${preload?.map((href) => ``)}
${head?.then((head) => head.title)}
${head?.then((head) =>
head.tags?.map(
(tag) =>
`<${tag.type} ${Object.entries(tag.attributes)
.map(([name, content]) => `${name}='${content}'`)
.join(' ')}/>`,
),
)}
${content}
${state?.then((state) => ``)}
`