git ssb

2+

mixmix / ticktack



Tree: 1967ee98ce129f2ab3b072bcdeac1ad9f0990092

Files: 1967ee98ce129f2ab3b072bcdeac1ad9f0990092 / app / html / blogNav.js

1413 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 'translations.sync.strings': 'first',
10})
11
12exports.create = (api) => {
13 return nest('app.html.blogNav', (location) => {
14 const strings = api.translations.sync.strings()
15 const goTo = (loc) => () => api.history.sync.push(loc)
16
17 if (location.page === 'blogIndex' || location.page === 'blogSearch') {
18 return h('BlogNav', [
19 h('div.left', [
20 h('div', {
21 className: location.page === 'blogIndex' ? '-active' : '',
22 'ev-click': goTo({ page: 'blogIndex' })
23 }, strings.blogNav.blogsAll),
24 h('div', {
25 className: location.page === 'blogSearch' ? '-active' : '',
26 'ev-click': goTo({ page: 'blogSearch' })
27 }, strings.blogNav.blogSearch),
28 ]),
29 h('div.right', [
30 h('Button -strong', { 'ev-click': () => api.history.sync.push({ page: 'blogNew' }) }, strings.blogNew.actions.writeBlog),
31 ])
32 ])
33 }
34
35 return h('BlogNav', [
36 h('div.left', [
37 h('div.-discovery', { 'ev-click': goTo({ page: 'blogIndex' }) }, [
38 h('i.fa.fa-chevron-left'),
39 strings.blogIndex.title
40 ]),
41 ]),
42 h('div.right', [
43 ])
44 ])
45 })
46}
47
48

Built with git-ssb-web