Files: 453e088bb1a566f6624aca8299dbbac2fee35272 / about / html / avatar.js
643 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = require('mutant') |
3 | |
4 | exports.gives = nest('about.html.avatar') |
5 | |
6 | exports.needs = nest({ |
7 | 'about.obs.imageUrl': 'first', |
8 | 'about.obs.color': 'first', |
9 | 'history.sync.push': 'first' |
10 | }) |
11 | |
12 | exports.create = function (api) { |
13 | return nest('about.html.avatar', function (id, size = 'small') { |
14 | return h('img', { |
15 | classList: `Avatar -${size}`, |
16 | style: { 'background-color': api.about.obs.color(id) }, |
17 | src: api.about.obs.imageUrl(id), |
18 | title: id, |
19 | 'ev-click': e => { |
20 | e.stopPropagation() |
21 | api.history.sync.push({ page: 'userShow', feed: id }) |
22 | } |
23 | }) |
24 | }) |
25 | } |
26 |
Built with git-ssb-web