git ssb

2+

mixmix / ticktack



Tree: 96570266185b2fbe938281bee30bde6029df8d47

Files: 96570266185b2fbe938281bee30bde6029df8d47 / app / html / blogNav.js

1469 bytesRaw
1const nest = require('depnest')
2const { h, computed, when } = require('mutant')
3const get = require('lodash/get')
4
5exports.gives = nest('app.html.blogNav')
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.blogNav', (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 (location.page === 'blogIndex' || location.page === 'blogSearch') {
20 return h('BlogNav', [
21 h('div.left', [
22 h('div', {
23 className: location.page === 'blogIndex' ? '-active' : '',
24 'ev-click': goTo({ page: 'blogIndex' })
25 }, strings.blogNav.blogsAll),
26 h('div', {
27 className: location.page === 'blogSearch' ? '-active' : '',
28 'ev-click': goTo({ page: 'blogSearch' })
29 }, strings.blogNav.blogSearch),
30 ]),
31 h('div.right', [
32 h('Button -strong', { 'ev-click': () => api.history.sync.push({ page: 'blogNew' }) }, strings.blogNew.actions.writeBlog),
33 ])
34 ])
35 }
36
37 return h('BlogNav', [
38 h('div.left', [
39 h('div.-discovery', { '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