Files: 514fd23969864c14dbe9d94ca098198db7e6624f / app / html / header.js
1005 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed } = require('mutant') |
3 | const get = require('lodash/get') |
4 | |
5 | exports.gives = nest('app.html.header') |
6 | |
7 | exports.needs = nest('keys.sync.id', 'first') |
8 | |
9 | const FEED_PAGES = [ |
10 | 'home', |
11 | 'blogIndex', |
12 | // 'blogSearch', |
13 | // 'threadShow', |
14 | // 'threadNew', |
15 | ] |
16 | const SETTINGS_PAGES = [ |
17 | 'settings', |
18 | 'userEdit', |
19 | ] |
20 | |
21 | exports.create = (api) => { |
22 | return nest('app.html.header', (nav) => { |
23 | const { location, push } = nav |
24 | const currentPage = computed(location, loc => get(loc, 'location.page')) |
25 | |
26 | return h('Header', [ |
27 | h('nav', [ |
28 | h('i.fa', { |
29 | 'ev-click': () => push({page: 'blogIndex'}), |
30 | className: computed(currentPage, page => FEED_PAGES.includes(page) ? 'fa-commenting' : 'fa-commenting-o') |
31 | }), |
32 | h('i.fa', { |
33 | className: computed(currentPage, page => SETTINGS_PAGES.includes(page) ? 'fa-user' : 'fa-user-o'), |
34 | 'ev-click': () => push({page: 'settings'}) |
35 | }) |
36 | ]), |
37 | ]) |
38 | }) |
39 | } |
40 |
Built with git-ssb-web