Convert context to a factory.

This commit is contained in:
Joshua Bemenderfer
2020-09-23 20:37:34 -04:00
parent 05c575bb26
commit 6f24dd523b
7 changed files with 57 additions and 62 deletions

View File

@@ -40,8 +40,7 @@ const styles = css`
`
export async function Footer (ctx, { path, title }) {
ctx.css.add(styles)
ctx.body = await body(ctx, { path, title })
ctx.addCSS(styles)
ctx.setBody(await body(ctx, { path, title }))
return ctx
}

View File

@@ -5,7 +5,7 @@ import base from '../styles/base.js'
const body = async (ctx, { path, title }) => html`
<header>
<h3 style="flex: 1;">Title: ${sanitize(title)}</h3>
${await ctx.b(NavBar, { path })}
${await ctx.renderBody(NavBar, { path })}
</header>
`
@@ -17,8 +17,8 @@ const styles = css`
`
export async function Header (ctx, { path, title }) {
ctx.css.add(styles)
ctx.body = await body(ctx, { path, title })
ctx.addCSS(styles)
ctx.setBody(await body(ctx, { path, title }))
return ctx
}

View File

@@ -52,7 +52,7 @@ const styles = css`
`
export function NavBar (ctx, { path }) {
ctx.css.add(styles)
ctx.body = body(path)
ctx.addCSS(styles)
ctx.setBody(body(path))
return ctx
}