git ssb

2+

mixmix / ticktack



Tree: e6df29b999257c928b0fe5316875680a479dba2e

Files: e6df29b999257c928b0fe5316875680a479dba2e / app / html / topNav / topNavBlog.js

1054 bytesRaw
1const nest = require('depnest')
2const { h } = require('mutant')
3
4exports.gives = nest('app.html.topNav')
5
6exports.needs = nest({
7 'history.sync.push': 'first',
8 'translations.sync.strings': 'first'
9})
10
11exports.create = (api) => {
12 return nest('app.html.topNav', (location) => {
13 const strings = api.translations.sync.strings()
14 const goTo = (loc) => () => api.history.sync.push(loc)
15
16 if (!['blogIndex', 'blogSearch'].includes(location.page)) return
17
18 return h('TopNav -blog', [
19 h('div.left', [
20 h('div', {
21 className: location.page === 'blogIndex' ? '-active' : '',
22 'ev-click': goTo({ page: 'blogIndex' })
23 }, strings.topNav.blogsAll),
24 h('div', {
25 className: location.page === 'blogSearch' ? '-active' : '',
26 'ev-click': goTo({ page: 'blogSearch' })
27 }, strings.topNav.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

Built with git-ssb-web