git ssb

2+

mixmix / ticktack



Commit 0e65bf76f75d4874321e893134b730597473287e

minimal discover sidebar

mix irving committed on 9/27/2017, 6:58:29 AM
Parent: 791d817894b256f9a26d15c977f65c023036c676

Files changed

app/html/context.jsadded
app/html/context.mcssadded
app/index.jschanged
app/page/blogIndex.jschanged
app/page/page.mcsschanged
styles/mixins.jschanged
translations/en.jschanged
app/html/context.jsView
@@ -1,0 +1,49 @@
1+const nest = require('depnest')
2+const { h, computed, map, when } = require('mutant')
3+
4+exports.gives = nest('app.html.context')
5+
6+exports.needs = nest({
7+ 'app.html.link': 'first',
8+ 'translations.sync.strings': 'first',
9+})
10+
11+
12+exports.create = (api) => {
13+ return nest('app.html.context', (location) => {
14+
15+ const strings = api.translations.sync.strings()
16+
17+ const discover = {
18+ notification: 1,
19+ imageEl: h('i.fa.fa-binoculars'),
20+ name: strings.blogIndex.title,
21+ location: { page: 'blogIndex' },
22+ selected: location.page === 'blogIndex' // TODO could be a whole host of pages
23+ }
24+
25+ const nearby = []
26+ const friendsWithThreads = []
27+
28+ return h('Context -feed', [
29+ h('div.level.-one', [
30+ Option(discover),
31+ map(nearby, Option), // TODO
32+ map(friendsWithThreads, Option) // TODO
33+ ]),
34+ // h('div.level.-two'),
35+ ])
36+
37+
38+ function Option ({ notification = 0, imageEl, name, location, selected }) {
39+ return h('Option', { className: selected ? '-selected' : '' }, [
40+ h('div.circle', [
41+ when(notification, h('div.alert', notification)),
42+ imageEl
43+ ]),
44+ api.app.html.link(location, name),
45+ ])
46+ }
47+ })
48+}
49+
app/html/context.mcssView
@@ -1,0 +1,69 @@
1+Context {
2+ display: flex
3+
4+ div.level {
5+ width: 11rem
6+ border-right: 1px gainsboro solid
7+
8+ display: flex
9+ flex-direction: column
10+
11+ div.Option {}
12+
13+ }
14+}
15+
16+Option {
17+ min-width: 8rem
18+ padding: 1rem
19+ display: flex
20+ align-items: center
21+
22+ -selected {
23+ $backgroundSelected
24+ }
25+
26+ div.circle {
27+ width: 3.6rem
28+ position: relative
29+
30+ div.alert {
31+ position: absolute
32+ width: 1.2rem
33+ height: 1.2rem
34+ border-radius: 1rem
35+ top: -.2rem
36+ left: -.2rem
37+
38+ background-color: red
39+ color: #fff
40+ font-size: .8rem
41+
42+ display: flex
43+ justify-content: center
44+ align-items: center
45+ }
46+
47+ a img {
48+
49+ }
50+ i {
51+ $avatarSmall
52+ $colorPrimary
53+ font-size: 1.3rem
54+ display: flex
55+ justify-content: center
56+ align-items: center
57+ }
58+
59+ }
60+
61+ div.Link {
62+ flex-grow: 1
63+
64+ display: flex
65+ align-items: center
66+ height: 3rem
67+ }
68+
69+}
app/index.jsView
@@ -3,8 +3,9 @@
33 catchLinkClick: require('./async/catch-link-click'),
44 },
55 html: {
66 app: require('./html/app'),
7+ context: require('./html/context'),
78 header: require('./html/header'),
89 thread: require('./html/thread'),
910 link: require('./html/link'),
1011 threadCard: require('./html/thread-card'),
app/page/blogIndex.jsView
@@ -8,13 +8,14 @@
88
99 exports.gives = nest('app.page.blogIndex')
1010
1111 exports.needs = nest({
12+ 'app.html.context': 'first',
13+ 'app.html.threadCard': 'first',
1214 'history.sync.push': 'first',
1315 'keys.sync.id': 'first',
1416 'translations.sync.strings': 'first',
1517 'state.obs.threads': 'first',
16- 'app.html.threadCard': 'first',
1718 'unread.sync.isUnread': 'first'
1819 })
1920
2021 exports.create = (api) => {
@@ -25,9 +26,9 @@
2526 //
2627 var strings = api.translations.sync.strings()
2728
2829 return h('Page -blogIndex', {title: strings.home}, [
29- h('div.context', 'context (sidebar)'),
30+ api.app.html.context(location),
3031 h('div.content', [
3132 blogs(),
3233 h('Button -showMore', { 'ev-click': contentHtmlObs.more }, strings.showMore)
3334 ]),
app/page/page.mcssView
@@ -5,13 +5,12 @@
55 margin-top: 3rem
66
77 display: flex
88
9- div.context {
9+ div.Context {
1010 min-height: calc(100% - 3rem)
1111 overflow-y: auto
12-
13- padding: 1rem
12+ overflow-x: hidden
1413 }
1514
1615 div.content {
1716 min-height: calc(100% - 3rem)
styles/mixins.jsView
@@ -33,19 +33,23 @@
3333 }
3434 }
3535
3636 $colorPrimaryFG {
37- color: #2f63ad
37+ color: #fff
3838 }
3939
4040 $colorSubtle {
4141 color: #222
4242 }
4343
4444 $backgroundPrimary {
45- background-color: #f7f7f7
45+ background-color: #fff
4646 }
4747
48+$backgroundSelected {
49+ background-color: #f0f1f2
50+}
51+
4852 $borderBackgroundPrimary {
4953 border: 1px #f7f7f7 solid
5054 }
5155
translations/en.jsView
@@ -1,5 +1,8 @@
11 module.exports = {
2+ blogIndex: {
3+ title: 'Discover',
4+ },
25 loading: 'Loading...',
36 optionalField: 'optional',
47 sendMessage: 'Send',
58 showMore: 'Show More',

Built with git-ssb-web