Files: c8ebe98ed356a8b95e516ca561f755e05ed43156 / book / html / description.js
605 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed, when } = require('mutant') |
3 | |
4 | exports.needs = nest({ |
5 | 'message.html.markdown': 'first' |
6 | }) |
7 | |
8 | exports.gives = nest('book.html.description') |
9 | |
10 | exports.create = (api) => { |
11 | return nest('book.html.description', description) |
12 | function description ({description, isEditing, onUpdate}) { |
13 | const markdown = api.message.html.markdown |
14 | const input = h('textarea', {'ev-input': e => onUpdate(e.target.value), value: description}) |
15 | |
16 | return h('Description', [ |
17 | when(isEditing, |
18 | input, |
19 | computed(description, markdown) |
20 | ) |
21 | ]) |
22 | } |
23 | } |
24 |
Built with git-ssb-web