git ssb

16+

Dominic / patchbay



Tree: d2fc80d053b60b029fe06052bffd46c21ec9caa2

Files: d2fc80d053b60b029fe06052bffd46c21ec9caa2 / modules_basic / message-author.js

886 bytesRaw
1const getStyleForModule = require('../get-style-for-module')
2const h = require('../h')
3const when = require('@mmckegg/mutant/when')
4
5exports.needs = {
6 avatar_link: 'first',
7 avatar_image: 'first',
8 avatar_name: 'first',
9 timestamp: 'first'
10}
11
12exports.gives = {
13 message_author: true,
14 mcss: true
15}
16
17exports.create = function (api) {
18 return {
19 message_author,
20 mcss: getStyleForModule(__filename)
21 }
22
23 function message_author (msg, opts = {}) {
24 var { size = 'small' } = opts
25 var { value } = msg
26 var { author } = value
27
28 return h('MessageAuthor', {
29 className: `-${size}`
30 }, [
31 when(size !== 'mini',
32 h('section -image', api.avatar_link(author, api.avatar_image(author, 'thumbnail')))
33 ),
34 h('section -name', api.avatar_link(author, api.avatar_name(author))),
35 h('section -timestamp', api.timestamp(msg))
36 ])
37 }
38}
39
40

Built with git-ssb-web