mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-15 07:32:48 +01:00
29 lines
782 B
JavaScript
29 lines
782 B
JavaScript
|
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;
|
||
|
};
|
||
|
};
|