Commit b4a12543a07fd041ced6d5f8589af61a578fc331
add actual styling to About widget, small bugfixes
mix irving authored on 12/20/2016, 8:46:07 AMMichael Williams committed on 12/23/2016, 7:27:16 AM
Parent: b8e6d427ed5866257d6c408c54c6b498b598353c
Files changed
modules_basic/about.js | changed |
modules_basic/about.js | ||
---|---|---|
@@ -12,9 +12,14 @@ | ||
12 | 12 … | } |
13 | 13 … | |
14 | 14 … | var mcss = ` |
15 | 15 … | About { |
16 | - background-color: red | |
16 … | + display: flex | |
17 … | + flex-wrap: wrap | |
18 … | + | |
19 … | + header { | |
20 … | + margin-right: .4rem | |
21 … | + } | |
17 | 22 … | } |
18 | 23 … | ` |
19 | 24 … | |
20 | 25 … | exports.create = function (api) { |
@@ -30,23 +35,25 @@ | ||
30 | 35 … | var { about: aboutId, name, image, description } = about |
31 | 36 … | |
32 | 37 … | // if(!image && !name) return |
33 | 38 … | |
34 | - return h('.About', {}, [ | |
39 … | + return h('div', {className: 'About'}, [ | |
35 | 40 … | verb({ aboutId, authorId: msg.value.author }), |
36 | - profile({ aboutId, name, image, description }) | |
41 … | + profile({ aboutId, name, image, description, api }) | |
37 | 42 … | ]) |
38 | 43 … | } |
39 | 44 … | } |
40 | 45 … | |
41 | 46 … | |
42 | 47 … | function verb ({ aboutId, authorId }) { |
43 | - return authorId === aboutId | |
44 | - ? h('span', 'self-identifies as') | |
45 | - : h('span', ['identifies ', idLink(aboutId), ' as ']) | |
48 … | + var content = authorId === aboutId | |
49 … | + ? 'self-identifies as' | |
50 … | + : ['identifies ', idLink(aboutId), ' as'] | |
51 … | + | |
52 … | + return h('header', content) | |
46 | 53 … | } |
47 | 54 … | |
48 | -function profile ({ aboutId, name, image, description }) { | |
55 … | +function profile ({ aboutId, name, image, description, api }) { | |
49 | 56 … | return h('div', [ |
50 | 57 … | name |
51 | 58 … | ? h('a', {href:'#'+aboutId}, name) |
52 | 59 … | : null, |
@@ -57,9 +64,11 @@ | ||
57 | 64 … | ]) |
58 | 65 … | } |
59 | 66 … | |
60 | 67 … | function idLink (id) { |
61 | - return h('a', {href:'#'+id}, id) | |
68 … | + if (!id) return null | |
69 … | + | |
70 … | + return h('a', {href:'#'+id}, id.slice(0,9) + '...') | |
62 | 71 … | } |
63 | 72 … | |
64 | 73 … | function asLink (ln) { |
65 | 74 … | return typeof ln === 'string' ? ln : ln.link |
Built with git-ssb-web