Files: f9490b57823c88d2d4e1cdc8495b8ab60d63862f / book / html / authors.js
760 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, when } = require('mutant') |
3 | |
4 | exports.needs = nest({ |
5 | 'blob.sync.url': 'first', |
6 | 'app.sync.goTo': 'first' |
7 | }) |
8 | |
9 | exports.gives = nest( |
10 | 'book.html.authors' |
11 | ) |
12 | |
13 | exports.create = (api) => { |
14 | return nest('book.html.authors', authors) |
15 | function authors ({authors, isEditing, onUpdate}) { |
16 | return h('section.authors', |
17 | when(isEditing, |
18 | h('input', { |
19 | 'ev-input': e => onUpdate(e.target.value), |
20 | placeholder: 'Authors', |
21 | value: authors |
22 | }), |
23 | h('a', { 'href': '#', |
24 | 'ev-click': () => api.app.sync.goTo({ |
25 | page: 'books', |
26 | query: 'authors=' + authors() |
27 | }) |
28 | }, authors) |
29 | ) |
30 | ) |
31 | } |
32 | } |
33 |
Built with git-ssb-web