git ssb

3+

arj / patchbook



Tree: f9490b57823c88d2d4e1cdc8495b8ab60d63862f

Files: f9490b57823c88d2d4e1cdc8495b8ab60d63862f / book / html / images.js

607 bytesRaw
1const nest = require('depnest')
2const { h, Set, map, forEach, when } = require('mutant')
3
4exports.needs = nest({
5 'blob.sync.url': 'first',
6 'blob.html.input': 'first'
7})
8
9exports.gives = nest('book.html.images')
10
11exports.create = (api) => {
12 return nest('book.html.images', images)
13 function images ({images, isEditing, onUpdate}) {
14 const fileInput = api.blob.html.input(file => {
15 onUpdate(file)
16 })
17
18 return h('section.images', {}, [
19 map(images, image => h('img', {src: api.blob.sync.url(image.link)})),
20 when(isEditing, [h('div', 'Add an image:'), fileInput])
21 ])
22 }
23}
24

Built with git-ssb-web