Files: b6d7ee34ab7b57861dd88fc633ba98bfb721b099 / lib / depject / sheet / display.js
690 bytesRaw
1 | const h = require('mutant/h') |
2 | const nest = require('depnest') |
3 | |
4 | exports.gives = nest('sheet.display') |
5 | |
6 | exports.create = function () { |
7 | return nest('sheet.display', function (handler) { |
8 | const { content, footer, classList, onMount, attributes } = handler(done) |
9 | |
10 | let fullAttributes = { className: 'Sheet', classList } |
11 | if (attributes !== undefined) { |
12 | fullAttributes = { ...attributes, ...fullAttributes } |
13 | } |
14 | const container = h('div', fullAttributes, [ |
15 | h('section', [content]), |
16 | h('footer', [footer]) |
17 | ]) |
18 | |
19 | document.body.appendChild(container) |
20 | |
21 | if (onMount) onMount() |
22 | |
23 | function done () { |
24 | document.body.removeChild(container) |
25 | } |
26 | }) |
27 | } |
28 |
Built with git-ssb-web