Files: 9b7b6df024c1c91b5fa96dbbe3c3cbf1e5000f18 / app / html / topNav / topNavBlog.js
1115 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed, when } = require('mutant') |
3 | const get = require('lodash/get') |
4 | |
5 | exports.gives = nest('app.html.topNav') |
6 | |
7 | exports.needs = nest({ |
8 | 'history.sync.push': 'first', |
9 | 'translations.sync.strings': 'first', |
10 | }) |
11 | |
12 | exports.create = (api) => { |
13 | return nest('app.html.topNav', (location) => { |
14 | const strings = api.translations.sync.strings() |
15 | const goTo = (loc) => () => api.history.sync.push(loc) |
16 | |
17 | if (!['blogIndex', 'blogSearch'].includes(location.page)) return |
18 | |
19 | return h('TopNav -blog', [ |
20 | h('div.left', [ |
21 | h('div', { |
22 | className: location.page === 'blogIndex' ? '-active' : '', |
23 | 'ev-click': goTo({ page: 'blogIndex' }) |
24 | }, strings.topNav.blogsAll), |
25 | h('div', { |
26 | className: location.page === 'blogSearch' ? '-active' : '', |
27 | 'ev-click': goTo({ page: 'blogSearch' }) |
28 | }, strings.topNav.blogSearch), |
29 | ]), |
30 | h('div.right', [ |
31 | h('Button -strong', { 'ev-click': () => api.history.sync.push({ page: 'blogNew' }) }, strings.blogNew.actions.writeBlog), |
32 | ]) |
33 | ]) |
34 | }) |
35 | } |
36 | |
37 |
Built with git-ssb-web