2018-11-12 20:13:31 +01:00
|
|
|
const html = require('choo/html');
|
|
|
|
const Promo = require('./promo');
|
|
|
|
const Header = require('./header');
|
|
|
|
const Footer = require('./footer');
|
|
|
|
|
|
|
|
function banner(state) {
|
2019-03-13 18:30:03 +01:00
|
|
|
if (state.layout) {
|
|
|
|
return; // server side
|
|
|
|
}
|
|
|
|
const show =
|
2019-05-30 04:22:03 +02:00
|
|
|
!state.capabilities.standalone && !state.route.startsWith('/unsupported/');
|
2019-03-13 18:30:03 +01:00
|
|
|
if (show) {
|
2018-11-12 20:13:31 +01:00
|
|
|
return state.cache(Promo, 'promo').render();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = function body(main) {
|
|
|
|
return function(state, emit) {
|
|
|
|
const b = html`
|
|
|
|
<body
|
2019-02-11 22:48:06 +01:00
|
|
|
class="flex flex-col items-center font-sans md:h-screen md:bg-grey-lightest"
|
2018-11-12 20:13:31 +01:00
|
|
|
>
|
|
|
|
${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;
|
|
|
|
};
|
|
|
|
};
|