converting some things to choo/component
This commit is contained in:
parent
a576d54d64
commit
037c79730d
16 changed files with 270 additions and 381 deletions
28
app/ui/body.js
Normal file
28
app/ui/body.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const html = require('choo/html');
|
||||
const Promo = require('./promo');
|
||||
const Header = require('./header');
|
||||
const Footer = require('./footer');
|
||||
|
||||
function banner(state) {
|
||||
if (state.promo && !state.route.startsWith('/unsupported/')) {
|
||||
return state.cache(Promo, 'promo').render();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function body(main) {
|
||||
return function(state, emit) {
|
||||
const b = html`
|
||||
<body
|
||||
class="flex flex-col items-center font-sans bg-blue-lightest md:h-screen md:bg-grey-lightest"
|
||||
>
|
||||
${banner(state, emit)} ${state.cache(Header, 'header').render()}
|
||||
${main(state, emit)} ${state.cache(Footer, 'footer').render()}
|
||||
</body>
|
||||
`;
|
||||
if (state.layout) {
|
||||
// server side only
|
||||
return state.layout(state, b);
|
||||
}
|
||||
return b;
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue