2018-11-12 20:13:31 +01:00
|
|
|
const html = require('choo/html');
|
|
|
|
const Header = require('./header');
|
|
|
|
const Footer = require('./footer');
|
|
|
|
|
|
|
|
module.exports = function body(main) {
|
|
|
|
return function(state, emit) {
|
|
|
|
const b = html`
|
|
|
|
<body
|
2019-09-09 19:34:55 +02:00
|
|
|
class="flex flex-col items-center font-sans md:h-screen md:bg-grey-10 dark:bg-black"
|
2018-11-12 20:13:31 +01:00
|
|
|
>
|
2020-10-15 18:08:28 +02:00
|
|
|
${state.cache(Header, 'header').render()} ${main(state, emit)}
|
|
|
|
${state.cache(Footer, 'footer').render()}
|
2018-11-12 20:13:31 +01:00
|
|
|
</body>
|
|
|
|
`;
|
|
|
|
if (state.layout) {
|
|
|
|
// server side only
|
|
|
|
return state.layout(state, b);
|
|
|
|
}
|
|
|
|
return b;
|
|
|
|
};
|
|
|
|
};
|