Commit 5b50cf4764591456ca0e705aba348269bf6c3268
rename blogNav to topNav and use depject
mix committed on 1/24/2018, 9:47:39 PMParent: c27d9c765e55088d4fd855d29313c20839bb982c
Files changed
app/html/blogNav.js | deleted |
app/html/blogNav.mcss | deleted |
app/html/topNav/topNav.mcss | added |
app/html/topNav/topNavBlog.js | added |
app/html/topNav/topNavBlog.mcss | added |
app/html/topNav/zz_topNavBack.js | added |
app/html/topNav/zz_topNavBack.mcss | added |
app/index.js | changed |
app/page/blogIndex.js | changed |
app/page/blogSearch.js | changed |
app/page/blogShow.js | changed |
app/page/userShow.js | changed |
translations/en.js | changed |
translations/zh.js | changed |
app/html/blogNav.js | ||
---|---|---|
@@ -1,49 +1,0 @@ | ||
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.blogNav') | |
6 | - | |
7 | -exports.needs = nest({ | |
8 | - 'history.sync.push': 'first', | |
9 | - 'history.sync.back': 'first', | |
10 | - 'translations.sync.strings': 'first', | |
11 | -}) | |
12 | - | |
13 | -exports.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 | - |
app/html/blogNav.mcss | ||
---|---|---|
@@ -1,36 +1,0 @@ | ||
1 | -BlogNav { | |
2 | - background-color: #fff | |
3 | - height: 2.5rem | |
4 | - padding: 1rem | |
5 | - padding-bottom: .5rem | |
6 | - | |
7 | - display: flex | |
8 | - justify-content: space-between | |
9 | - | |
10 | - div.left { | |
11 | - display: flex | |
12 | - | |
13 | - div { | |
14 | - font-size: 1rem | |
15 | - $colorFontSubtle | |
16 | - cursor: pointer | |
17 | - | |
18 | - padding-bottom: .6rem | |
19 | - margin: .5rem 1rem .5rem .5rem | |
20 | - | |
21 | - -active { | |
22 | - $colorFontBasic | |
23 | - border-bottom: 2px solid #222 | |
24 | - } | |
25 | - | |
26 | - -discovery { | |
27 | - $colorFontBasic | |
28 | - i { margin-right: .5rem } | |
29 | - } | |
30 | - } | |
31 | - } | |
32 | - | |
33 | - div.right { | |
34 | - } | |
35 | -} | |
36 | - |
app/html/topNav/topNav.mcss | ||
---|---|---|
@@ -1,0 +1,31 @@ | ||
1 | +TopNav { | |
2 | + background-color: #fff | |
3 | + height: 2.5rem | |
4 | + padding: 1rem | |
5 | + padding-bottom: .5rem | |
6 | + | |
7 | + display: flex | |
8 | + justify-content: space-between | |
9 | + | |
10 | + div.left { | |
11 | + display: flex | |
12 | + | |
13 | + div { | |
14 | + font-size: 1rem | |
15 | + $colorFontSubtle | |
16 | + cursor: pointer | |
17 | + | |
18 | + padding-bottom: .6rem | |
19 | + margin: .5rem 1rem .5rem .5rem | |
20 | + | |
21 | + -active { | |
22 | + $colorFontBasic | |
23 | + border-bottom: 2px solid #222 | |
24 | + } | |
25 | + } | |
26 | + } | |
27 | + | |
28 | + div.right { | |
29 | + } | |
30 | +} | |
31 | + |
app/html/topNav/topNavBlog.js | ||
---|---|---|
@@ -1,0 +1,49 @@ | ||
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 | + 'history.sync.back': 'first', | |
10 | + 'translations.sync.strings': 'first', | |
11 | +}) | |
12 | + | |
13 | +exports.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 | + |
app/html/topNav/topNavBlog.mcss | ||
---|---|---|
@@ -1,0 +1,13 @@ | ||
1 | +TopNav -blog { | |
2 | + div.left { | |
3 | + display: flex | |
4 | + div { | |
5 | + font-size: 1rem | |
6 | + /* dummy entry to stop mccs breaking */ | |
7 | + } | |
8 | + } | |
9 | + | |
10 | + div.right { | |
11 | + } | |
12 | +} | |
13 | + |
app/html/topNav/zz_topNavBack.js | ||
---|---|---|
@@ -1,0 +1,30 @@ | ||
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 | + 'history.sync.back': 'first', | |
10 | + 'translations.sync.strings': 'first', | |
11 | +}) | |
12 | + | |
13 | +exports.create = (api) => { | |
14 | + return nest('app.html.topNav', (location) => { | |
15 | + // const strings = api.translations.sync.strings() | |
16 | + const back = () => api.history.sync.back() | |
17 | + | |
18 | + return h('TopNav -back', [ | |
19 | + h('div.left', [ | |
20 | + h('div', { 'ev-click': back }, [ | |
21 | + h('i.fa.fa-chevron-left'), | |
22 | + // strings.blogIndex.title | |
23 | + ]), | |
24 | + ]), | |
25 | + h('div.right', [ | |
26 | + ]) | |
27 | + ]) | |
28 | + }) | |
29 | +} | |
30 | + |
app/html/topNav/zz_topNavBack.mcss | ||
---|---|---|
@@ -1,0 +1,13 @@ | ||
1 | +TopNav -back { | |
2 | + div.left { | |
3 | + div { | |
4 | + $colorFontBasic | |
5 | + i { margin-right: .5rem } | |
6 | + } | |
7 | + } | |
8 | + | |
9 | + div.right { | |
10 | + } | |
11 | +} | |
12 | + | |
13 | + |
app/index.js | ||
---|---|---|
@@ -9,9 +9,12 @@ | ||
9 | 9 | thread: require('./html/thread'), |
10 | 10 | link: require('./html/link'), |
11 | 11 | lightbox: require('./html/lightbox'), |
12 | 12 | blogCard: require('./html/blogCard'), |
13 | - blogNav: require('./html/blogNav'), | |
13 | + topNav: { | |
14 | + topNavBlog: require('./html/topNav/topNavBlog'), | |
15 | + topNavBack: require('./html/topNav/zz_topNavBack'), | |
16 | + }, | |
14 | 17 | scroller: require('./html/scroller'), |
15 | 18 | sideNav: { |
16 | 19 | discovery: require('./html/sideNav/sideNavDiscovery'), |
17 | 20 | } |
app/page/blogIndex.js | ||
---|---|---|
@@ -6,9 +6,9 @@ | ||
6 | 6 | |
7 | 7 | exports.needs = nest({ |
8 | 8 | 'app.html.sideNav': 'first', |
9 | 9 | 'app.html.blogCard': 'first', |
10 | - 'app.html.blogNav': 'first', | |
10 | + 'app.html.topNav': 'first', | |
11 | 11 | 'app.html.scroller': 'first', |
12 | 12 | // 'feed.pull.public': 'first', |
13 | 13 | 'feed.pull.type': 'first', |
14 | 14 | 'history.sync.push': 'first', |
@@ -25,9 +25,9 @@ | ||
25 | 25 | var strings = api.translations.sync.strings() |
26 | 26 | |
27 | 27 | var blogs = api.app.html.scroller({ |
28 | 28 | classList: ['content'], |
29 | - prepend: api.app.html.blogNav(location), | |
29 | + prepend: api.app.html.topNav(location), | |
30 | 30 | // stream: api.feed.pull.public, |
31 | 31 | stream: api.feed.pull.type('blog'), |
32 | 32 | filter: () => pull( |
33 | 33 | // pull.filter(msg => { |
app/page/blogSearch.js | ||
---|---|---|
@@ -6,9 +6,9 @@ | ||
6 | 6 | |
7 | 7 | exports.needs = nest({ |
8 | 8 | 'app.html.sideNav': 'first', |
9 | 9 | 'app.html.blogCard': 'first', |
10 | - 'app.html.blogNav': 'first', | |
10 | + 'app.html.topNav': 'first', | |
11 | 11 | 'app.html.scroller': 'first', |
12 | 12 | 'channel.obs.recent': 'first', |
13 | 13 | 'feed.pull.channel': 'first', |
14 | 14 | 'feed.pull.public': 'first', |
@@ -64,9 +64,9 @@ | ||
64 | 64 | |
65 | 65 | var blogs = api.app.html.scroller({ |
66 | 66 | classList: ['content'], |
67 | 67 | prepend: [ |
68 | - api.app.html.blogNav(location), | |
68 | + api.app.html.topNav(location), | |
69 | 69 | searchField |
70 | 70 | ], |
71 | 71 | stream: createStream, |
72 | 72 | filter: () => pull( |
app/page/blogShow.js | ||
---|---|---|
@@ -8,9 +8,9 @@ | ||
8 | 8 | |
9 | 9 | exports.needs = nest({ |
10 | 10 | 'about.html.avatar': 'first', |
11 | 11 | 'about.obs.name': 'first', |
12 | - 'app.html.blogNav': 'first', | |
12 | + 'app.html.topNav': 'first', | |
13 | 13 | 'app.html.comments': 'first', |
14 | 14 | 'app.html.sideNav': 'first', |
15 | 15 | 'contact.html.follow': 'first', |
16 | 16 | 'message.html.channel': 'first', |
@@ -42,9 +42,9 @@ | ||
42 | 42 | return h('Page -blogShow', [ |
43 | 43 | api.app.html.sideNav({ page: 'discover' }), // HACK to highlight discover |
44 | 44 | h('div.content', [ |
45 | 45 | h('section.top', [ |
46 | - api.app.html.blogNav(location) | |
46 | + api.app.html.topNav(location) | |
47 | 47 | ]), |
48 | 48 | h('section.content', [ |
49 | 49 | h('header', [ |
50 | 50 | h('div.blog', [ |
app/page/userShow.js | ||
---|---|---|
@@ -12,9 +12,9 @@ | ||
12 | 12 | 'about.obs.description': 'first', |
13 | 13 | 'app.html.sideNav': 'first', |
14 | 14 | 'app.html.link': 'first', |
15 | 15 | 'app.html.blogCard': 'first', |
16 | - 'app.html.blogNav': 'first', | |
16 | + 'app.html.topNav': 'first', | |
17 | 17 | 'app.html.scroller': 'first', |
18 | 18 | 'contact.html.follow': 'first', |
19 | 19 | 'contact.html.block': 'first', |
20 | 20 | 'feed.pull.profile': 'first', |
@@ -57,9 +57,9 @@ | ||
57 | 57 | // }) |
58 | 58 | // }), |
59 | 59 | |
60 | 60 | const prepend = [ |
61 | - api.app.html.blogNav(location), | |
61 | + api.app.html.topNav(location), | |
62 | 62 | h('section.about', [ |
63 | 63 | api.about.html.avatar(feed, 'large'), |
64 | 64 | h('h1', [ |
65 | 65 | api.about.obs.name(feed), |
Built with git-ssb-web