Files: b4bb2278fc6720ae4aa5470a30a66da315b74f00 / app / html / lightbox.js
627 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed, when, Value } = require('mutant') |
3 | |
4 | exports.gives = nest('app.html.lightbox') |
5 | |
6 | exports.create = (api) => { |
7 | return nest('app.html.lightbox', (content, isOpen) => { |
8 | |
9 | if (typeof isOpen !== 'function') isOpen = Value(false) |
10 | |
11 | const openMe = () => isOpen.set(true) |
12 | const closeMe = () => isOpen.set(false) |
13 | |
14 | const lb = h('Lightbox', { className: when(isOpen, '-open', '-close'), 'ev-click': closeMe }, |
15 | h('div.content', {'ev-click': (ev) => ev.stopPropagation()}, [ |
16 | content |
17 | ])) |
18 | |
19 | lb.open = openMe |
20 | lb.close = closeMe |
21 | |
22 | return lb |
23 | }) |
24 | } |
25 | |
26 |
Built with git-ssb-web