Commit c9b7a28a4959b299b99666ef8ac687c2618da2cc
add about.html.avatar, making linking to profiles easier
mix irving committed on 8/29/2017, 2:02:29 AMParent: 47c13dae1c311219de77ffac244274f248275f29
Files changed
about/index.js | changed |
about/html/avatar.js | added |
about/html/avatar.mcss | added |
app/html/link.mcss | changed |
app/html/thread-card.js | changed |
app/html/thread-card.mcss | changed |
app/html/thread.js | changed |
about/index.js | ||
---|---|---|
@@ -1,5 +1,8 @@ | ||
1 | 1 | module.exports = { |
2 | 2 | async: { |
3 | 3 | suggest: require('./async/suggest') |
4 | - } | |
4 | + }, | |
5 | + html: { | |
6 | + avatar: require('./html/avatar') | |
7 | + }, | |
5 | 8 | } |
about/html/avatar.js | ||
---|---|---|
@@ -1,0 +1,22 @@ | ||
1 | +const nest = require('depnest') | |
2 | +const { h } = require('mutant') | |
3 | + | |
4 | +exports.needs = nest({ | |
5 | + 'about.html.image': 'first', | |
6 | + 'app.html.link': 'first' | |
7 | +}) | |
8 | + | |
9 | +exports.gives = nest('about.html.avatar') | |
10 | + | |
11 | +exports.create = function (api) { | |
12 | + return nest('about.html.avatar', feed => { | |
13 | + const Link = api.app.html.link | |
14 | + | |
15 | + return Link( | |
16 | + { page: 'userShow', feed }, | |
17 | + api.about.html.image(feed) | |
18 | + ) | |
19 | + | |
20 | + }) | |
21 | +} | |
22 | + |
app/html/link.mcss | ||
---|---|---|
@@ -1,6 +1,7 @@ | ||
1 | 1 | Link { |
2 | 2 | color: #222 |
3 | + cursor: pointer | |
3 | 4 | |
4 | 5 | -string { |
5 | 6 | :hover { |
6 | 7 | text-decoration: underline |
app/html/thread-card.js | ||
---|---|---|
@@ -8,9 +8,9 @@ | ||
8 | 8 | exports.needs = nest({ |
9 | 9 | 'keys.sync.id': 'first', |
10 | 10 | 'history.sync.push': 'first', |
11 | 11 | 'about.obs.name': 'first', |
12 | - 'about.html.image': 'first', | |
12 | + 'about.html.avatar': 'first', | |
13 | 13 | 'message.html.markdown': 'first', |
14 | 14 | 'translations.sync.strings': 'first', |
15 | 15 | 'unread.sync.isUnread': 'first' |
16 | 16 | }) |
@@ -47,9 +47,9 @@ | ||
47 | 47 | |
48 | 48 | return msg.value.content.recps |
49 | 49 | .map(link => isString(link) ? link : link.link) |
50 | 50 | .filter(link => link !== myId) |
51 | - .map(api.about.html.image) | |
51 | + .map(api.about.html.avatar) | |
52 | 52 | } |
53 | 53 | else if(msg.value.content.channel) |
54 | 54 | return '#'+msg.value.content.channel |
55 | 55 | } |
@@ -92,11 +92,11 @@ | ||
92 | 92 | // id is only here to help morphdom morph accurately |
93 | 93 | |
94 | 94 | var className = thread.unread ? '-unread': '' |
95 | 95 | |
96 | - return h('ThreadCard', { id, className, 'ev-click': onClick, }, [ | |
96 | + return h('ThreadCard', { id, className }, [ | |
97 | 97 | h('div.context', threadIcon(thread)), |
98 | - h('div.content', [ | |
98 | + h('div.content', {'ev-click': onClick}, [ | |
99 | 99 | subjectEl, |
100 | 100 | replySample ? h('div.reply', [ |
101 | 101 | h('i.fa.fa-caret-left'), |
102 | 102 | replySample |
app/html/thread-card.mcss | ||
---|---|---|
@@ -7,21 +7,25 @@ | ||
7 | 7 | div.context { |
8 | 8 | display: flex |
9 | 9 | margin-right: 1rem |
10 | 10 | font-weight: inherit |
11 | - img { | |
12 | - $avatarSmall | |
13 | - margin-right: .5rem | |
14 | - } | |
15 | 11 | } |
16 | 12 | |
17 | 13 | div.content { |
18 | 14 | flex-grow: 1 |
19 | 15 | |
16 | + cursor: pointer | |
20 | 17 | padding: 1rem |
21 | 18 | border: 1px solid #ddd |
22 | 19 | border-radius: 2px |
23 | 20 | |
21 | + transition: all .5s ease | |
22 | + | |
23 | + :hover { | |
24 | + background-color: #fff | |
25 | + border: 1px solid #fff | |
26 | + } | |
27 | + | |
24 | 28 | div.subject { |
25 | 29 | font-size: 1.2rem |
26 | 30 | margin-bottom: .3rem |
27 | 31 |
app/html/thread.js | ||
---|---|---|
@@ -4,9 +4,9 @@ | ||
4 | 4 | |
5 | 5 | exports.gives = nest('app.html.thread') |
6 | 6 | |
7 | 7 | exports.needs = nest({ |
8 | - 'about.html.image': 'first', | |
8 | + 'about.html.avatar': 'first', | |
9 | 9 | 'feed.obs.thread': 'first', |
10 | 10 | 'keys.sync.id': 'first', |
11 | 11 | 'message.html.markdown': 'first', |
12 | 12 | 'unread.sync.markRead': 'first', |
@@ -35,9 +35,9 @@ | ||
35 | 35 | ]) |
36 | 36 | })) |
37 | 37 | ]) |
38 | 38 | : h('div.other-chunk', [ |
39 | - h('div.avatar', when(author, api.about.html.image(author()))), | |
39 | + h('div.avatar', when(author, api.about.html.avatar(author()))), | |
40 | 40 | h('div.msgs', map(chunk, msg => { |
41 | 41 | return h('div.msg-row', [ |
42 | 42 | message(msg), |
43 | 43 | h('div.spacer') |
Built with git-ssb-web