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