git ssb

2+

mixmix / ticktack



Tree: 514fd23969864c14dbe9d94ca098198db7e6624f

Files: 514fd23969864c14dbe9d94ca098198db7e6624f / app / html / header.js

1005 bytesRaw
1const nest = require('depnest')
2const { h, computed } = require('mutant')
3const get = require('lodash/get')
4
5exports.gives = nest('app.html.header')
6
7exports.needs = nest('keys.sync.id', 'first')
8
9const FEED_PAGES = [
10 'home',
11 'blogIndex',
12 // 'blogSearch',
13 // 'threadShow',
14 // 'threadNew',
15]
16const SETTINGS_PAGES = [
17 'settings',
18 'userEdit',
19]
20
21exports.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