git ssb

16+

Dominic / patchbay



Tree: 4cc0d31d81a81e1f7fa95ad23f2a988b0c941e6d

Files: 4cc0d31d81a81e1f7fa95ad23f2a988b0c941e6d / message / html / layout / default.js

1031 bytesRaw
1const { h } = require('mutant')
2var nest = require('depnest')
3
4exports.needs = nest({
5 'message.html': {
6 backlinks: 'first',
7 author: 'first',
8 meta: 'map',
9 action: 'map',
10 timestamp: 'first'
11 },
12 'about.html.image': 'first'
13})
14
15exports.gives = nest('message.html.layout')
16
17exports.create = (api) => {
18 return nest('message.html.layout', messageLayout)
19
20 function messageLayout (msg, opts) {
21 if (!(opts.layout === undefined || opts.layout === 'default')) return
22
23 return h('Message', [
24 h('section.avatar', {}, api.about.html.image(msg.value.author)),
25 h('section.timestamp', {}, api.message.html.timestamp(msg)),
26 h('header.author', {}, api.message.html.author(msg)),
27 h('section.meta', {}, api.message.html.meta(msg)),
28 h('section.title', {}, opts.title),
29 h('section.content', {}, opts.content),
30 h('section.raw-content'),
31 h('section.actions', {}, api.message.html.action(msg)),
32 h('footer.backlinks', {}, api.message.html.backlinks(msg))
33 ])
34 }
35}
36
37

Built with git-ssb-web