Files: d1cbca468976daecdbe0e7e526ee93f7f56f9a9f / message / html / layout / default.js
1031 bytesRaw
1 | const { h } = require('mutant') |
2 | var nest = require('depnest') |
3 | |
4 | exports.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 | |
15 | exports.gives = nest('message.html.layout') |
16 | |
17 | exports.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