Files: 1e55478903ee72a0823df4336254a2e7a9da5b0e / app / html / lightbox.js
615 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, 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 | if (typeof isOpen !== 'function') isOpen = Value(false) |
9 | |
10 | const openMe = () => isOpen.set(true) |
11 | const closeMe = () => isOpen.set(false) |
12 | |
13 | const lb = h('Lightbox', { className: when(isOpen, '-open', '-close'), 'ev-click': closeMe }, |
14 | h('div.content', {'ev-click': (ev) => ev.stopPropagation()}, [ |
15 | content |
16 | ])) |
17 | |
18 | lb.open = openMe |
19 | lb.close = closeMe |
20 | |
21 | return lb |
22 | }) |
23 | } |
24 |
Built with git-ssb-web