Files: 199cb9733ad243e90145916e681fb93b45ad0ea6 / app / html / menu.js
645 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, Value } = require('mutant') |
3 | |
4 | exports.gives = nest('app.html.menu') |
5 | |
6 | exports.needs = nest({ |
7 | app: { |
8 | 'html.menuItem': 'map', |
9 | 'sync.goTo': 'first' |
10 | } |
11 | }) |
12 | |
13 | exports.create = function (api) { |
14 | var _menu |
15 | |
16 | return nest('app.html.menu', function menu () { |
17 | if (_menu) return _menu |
18 | |
19 | var state = Value('') |
20 | |
21 | // TODO: move goTo out into each menuItem |
22 | _menu = h('Menu', { |
23 | classList: [ state ], |
24 | 'ev-mouseover': () => state.set('-active'), |
25 | 'ev-mouseout': () => state.set('') |
26 | }, [ |
27 | h('div', api.app.html.menuItem(api.app.sync.goTo)) |
28 | ]) |
29 | |
30 | return _menu |
31 | }) |
32 | } |
33 | |
34 |
Built with git-ssb-web