git ssb

2+

mixmix / ticktack



Tree: 0e65bf76f75d4874321e893134b730597473287e

Files: 0e65bf76f75d4874321e893134b730597473287e / app / html / header.js

995 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 'blogIndex',
11 // 'blogSearch',
12 // 'threadShow',
13 // 'threadNew',
14]
15const SETTINGS_PAGES = [
16 'settings',
17 'userEdit',
18]
19
20exports.create = (api) => {
21 return nest('app.html.header', (nav) => {
22 const { location, push } = nav
23 const currentPage = computed(location, loc => get(loc, 'location.page'))
24
25 return h('Header', [
26 h('nav', [
27 h('i.fa', {
28 'ev-click': () => push({page: 'blogIndex'}),
29 className: computed(currentPage, page => FEED_PAGES.includes(page) ? 'fa-commenting' : 'fa-commenting-o')
30 }),
31 h('i.fa', {
32 className: computed(currentPage, page => SETTINGS_PAGES.includes(page) ? 'fa-user' : 'fa-user-o'),
33 'ev-click': () => push({page: 'settings'})
34 })
35 ]),
36 ])
37 })
38}
39

Built with git-ssb-web