git ssb

2+

mixmix / ticktack



Tree: 88433e9efc96be708a13620cbaa6502fa16a7411

Files: 88433e9efc96be708a13620cbaa6502fa16a7411 / app / html / header.js

1043 bytesRaw
1const nest = require('depnest')
2const { h, computed, when } = require('mutant')
3const get = require('lodash/get')
4
5exports.gives = nest('app.html.header')
6
7exports.needs = nest('keys.sync.id', 'first')
8
9const SETTINGS_PAGES = [
10 'settings',
11 'userEdit',
12]
13
14exports.create = (api) => {
15 return nest('app.html.header', (nav) => {
16 const { location, push } = nav
17
18 const loc = computed(location, location => {
19 if (typeof location != 'object') return {}
20
21 return location || {}
22 })
23
24 const isSettings = computed(loc, loc => {
25 return SETTINGS_PAGES.includes(loc.page)
26 })
27
28 const isFeed = computed([isSettings], isSettings => !isSettings)
29
30 return h('Header', [
31 h('nav', [
32 h('i.fa', {
33 'ev-click': () => push({page: 'blogIndex'}),
34 className: when(isFeed, 'fa-commenting', 'fa-commenting-o')
35 }),
36 h('i.fa', {
37 className: when(isSettings, 'fa-user', 'fa-user-o'),
38 'ev-click': () => push({page: 'settings'})
39 })
40 ]),
41 ])
42 })
43}
44

Built with git-ssb-web