app/html/nav.jsView |
---|
1 | | -const nest = require('depnest') |
2 | | -const { h } = require('mutant') |
3 | | - |
4 | | -exports.gives = nest('app.html.nav') |
5 | | - |
6 | | -exports.needs = nest({ |
7 | | - 'app.html.link': 'first', |
8 | | - 'history.sync.push': 'first', |
9 | | - 'history.sync.back': 'first' |
10 | | -}) |
11 | | - |
12 | | -exports.create = (api) => { |
13 | | - return nest('app.html.nav', nav) |
14 | | - |
15 | | - function nav (id) { |
16 | | - const { push, back } = api.history.sync |
17 | | - |
18 | | - const goHome = () => push({page: 'home'}) |
19 | | - |
20 | | - const Link = api.app.html.link |
21 | | - |
22 | | - return h('Nav', [ |
23 | | - h('div.back', { 'ev-click': back }, '←'), |
24 | | - h('div', { 'ev-click': goHome }, 'Home'), |
25 | | - Link({ page: 'settings' }, 'Settings'), |
26 | | - Link({ page: 'userFind' }, 'Find a User'), |
27 | | - h('a', { href: '%YRhFXmsAwipgyiwuHSP+EBr9fGjSqrMpWXUxgWcHxkM=.sha256' }, 'A Thread') |
28 | | - ]) |
29 | | - } |
30 | | -} |
31 | | - |