git ssb

2+

mixmix / ticktack



Tree: 5b50cf4764591456ca0e705aba348269bf6c3268

Files: 5b50cf4764591456ca0e705aba348269bf6c3268 / app / html / topNav / topNavBlog.js

1430 bytesRaw
1const nest = require('depnest')
2const { h, computed, when } = require('mutant')
3const get = require('lodash/get')
4
5exports.gives = nest('app.html.topNav')
6
7exports.needs = nest({
8 'history.sync.push': 'first',
9 'history.sync.back': 'first',
10 'translations.sync.strings': 'first',
11})
12
13exports.create = (api) => {
14 return nest('app.html.topNav', (location) => {
15 const strings = api.translations.sync.strings()
16 const goTo = (loc) => () => api.history.sync.push(loc)
17 const back = () => api.history.sync.back()
18
19 if (!['blogIndex', 'blogSearch'].includes(location.page)) return
20
21 return h('TopNav -blog', [
22 h('div.left', [
23 h('div', {
24 className: location.page === 'blogIndex' ? '-active' : '',
25 'ev-click': goTo({ page: 'blogIndex' })
26 }, strings.topNav.blogsAll),
27 h('div', {
28 className: location.page === 'blogSearch' ? '-active' : '',
29 'ev-click': goTo({ page: 'blogSearch' })
30 }, strings.topNav.blogSearch),
31 ]),
32 h('div.right', [
33 h('Button -strong', { 'ev-click': () => api.history.sync.push({ page: 'blogNew' }) }, strings.blogNew.actions.writeBlog),
34 ])
35 ])
36
37 return h('TopNav -back', [
38 h('div.left', [
39 h('div.-back', { 'ev-click': back }, [
40 h('i.fa.fa-chevron-left'),
41 strings.blogIndex.title
42 ]),
43 ]),
44 h('div.right', [
45 ])
46 ])
47 })
48}
49
50

Built with git-ssb-web