git ssb

2+

mixmix / ticktack



Tree: 780b6c7547c81e9ac9c612627a555dbe8ccbf399

Files: 780b6c7547c81e9ac9c612627a555dbe8ccbf399 / 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