git ssb

2+

mixmix / ticktack



Commit 5b50cf4764591456ca0e705aba348269bf6c3268

rename blogNav to topNav and use depject

mix committed on 1/24/2018, 9:47:39 PM
Parent: c27d9c765e55088d4fd855d29313c20839bb982c

Files changed

app/html/blogNav.jsdeleted
app/html/blogNav.mcssdeleted
app/html/topNav/topNav.mcssadded
app/html/topNav/topNavBlog.jsadded
app/html/topNav/topNavBlog.mcssadded
app/html/topNav/zz_topNavBack.jsadded
app/html/topNav/zz_topNavBack.mcssadded
app/index.jschanged
app/page/blogIndex.jschanged
app/page/blogSearch.jschanged
app/page/blogShow.jschanged
app/page/userShow.jschanged
translations/en.jschanged
translations/zh.jschanged
app/html/blogNav.jsView
@@ -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.mcssView
@@ -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.mcssView
@@ -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.jsView
@@ -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.mcssView
@@ -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.jsView
@@ -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.mcssView
@@ -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.jsView
@@ -9,9 +9,12 @@
99 thread: require('./html/thread'),
1010 link: require('./html/link'),
1111 lightbox: require('./html/lightbox'),
1212 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+ },
1417 scroller: require('./html/scroller'),
1518 sideNav: {
1619 discovery: require('./html/sideNav/sideNavDiscovery'),
1720 }
app/page/blogIndex.jsView
@@ -6,9 +6,9 @@
66
77 exports.needs = nest({
88 'app.html.sideNav': 'first',
99 'app.html.blogCard': 'first',
10- 'app.html.blogNav': 'first',
10+ 'app.html.topNav': 'first',
1111 'app.html.scroller': 'first',
1212 // 'feed.pull.public': 'first',
1313 'feed.pull.type': 'first',
1414 'history.sync.push': 'first',
@@ -25,9 +25,9 @@
2525 var strings = api.translations.sync.strings()
2626
2727 var blogs = api.app.html.scroller({
2828 classList: ['content'],
29- prepend: api.app.html.blogNav(location),
29+ prepend: api.app.html.topNav(location),
3030 // stream: api.feed.pull.public,
3131 stream: api.feed.pull.type('blog'),
3232 filter: () => pull(
3333 // pull.filter(msg => {
app/page/blogSearch.jsView
@@ -6,9 +6,9 @@
66
77 exports.needs = nest({
88 'app.html.sideNav': 'first',
99 'app.html.blogCard': 'first',
10- 'app.html.blogNav': 'first',
10+ 'app.html.topNav': 'first',
1111 'app.html.scroller': 'first',
1212 'channel.obs.recent': 'first',
1313 'feed.pull.channel': 'first',
1414 'feed.pull.public': 'first',
@@ -64,9 +64,9 @@
6464
6565 var blogs = api.app.html.scroller({
6666 classList: ['content'],
6767 prepend: [
68- api.app.html.blogNav(location),
68+ api.app.html.topNav(location),
6969 searchField
7070 ],
7171 stream: createStream,
7272 filter: () => pull(
app/page/blogShow.jsView
@@ -8,9 +8,9 @@
88
99 exports.needs = nest({
1010 'about.html.avatar': 'first',
1111 'about.obs.name': 'first',
12- 'app.html.blogNav': 'first',
12+ 'app.html.topNav': 'first',
1313 'app.html.comments': 'first',
1414 'app.html.sideNav': 'first',
1515 'contact.html.follow': 'first',
1616 'message.html.channel': 'first',
@@ -42,9 +42,9 @@
4242 return h('Page -blogShow', [
4343 api.app.html.sideNav({ page: 'discover' }), // HACK to highlight discover
4444 h('div.content', [
4545 h('section.top', [
46- api.app.html.blogNav(location)
46+ api.app.html.topNav(location)
4747 ]),
4848 h('section.content', [
4949 h('header', [
5050 h('div.blog', [
app/page/userShow.jsView
@@ -12,9 +12,9 @@
1212 'about.obs.description': 'first',
1313 'app.html.sideNav': 'first',
1414 'app.html.link': 'first',
1515 'app.html.blogCard': 'first',
16- 'app.html.blogNav': 'first',
16+ 'app.html.topNav': 'first',
1717 'app.html.scroller': 'first',
1818 'contact.html.follow': 'first',
1919 'contact.html.block': 'first',
2020 'feed.pull.profile': 'first',
@@ -57,9 +57,9 @@
5757 // })
5858 // }),
5959
6060 const prepend = [
61- api.app.html.blogNav(location),
61+ api.app.html.topNav(location),
6262 h('section.about', [
6363 api.about.html.avatar(feed, 'large'),
6464 h('h1', [
6565 api.about.obs.name(feed),
translations/en.jsView
@@ -7,9 +7,9 @@
77 },
88 blogIndex: {
99 title: 'Discover',
1010 },
11- blogNav: {
11+ topNav: {
1212 blogsAll: 'Dynamics',
1313 blogSearch: 'Search'
1414 },
1515 blogNew: {
translations/zh.jsView
@@ -26,9 +26,9 @@
2626 preview: '预览',
2727 writeBlog: '撰文'
2828 }
2929 },
30- blogNav: {
30+ topNav: {
3131 blogsAll: '最新',
3232 blogSearch: '搜索'
3333 },
3434 groupFind: {

Built with git-ssb-web