Files: 905df22ab68b63477bb10099aff3b6d0c8ef9f09 / message / html / layout / mini.js
836 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, Value } = require('mutant') |
3 | |
4 | exports.needs = nest('message.html', { |
5 | backlinks: 'first', |
6 | author: 'first', |
7 | meta: 'map', |
8 | timestamp: 'first' |
9 | }) |
10 | |
11 | exports.gives = nest('message.html.layout') |
12 | |
13 | exports.create = (api) => { |
14 | return nest('message.html.layout', miniLayout) |
15 | |
16 | function miniLayout (msg, opts) { |
17 | if (opts.layout !== 'mini') return |
18 | |
19 | var rawMessage = Value(null) |
20 | |
21 | return h('Message -mini', { |
22 | attributes: { |
23 | tabindex: '0' |
24 | } |
25 | }, [ |
26 | h('section.timestamp', {}, api.message.html.timestamp(msg)), |
27 | h('header.author', {}, api.message.html.author(msg, { size: 'mini' })), |
28 | h('section.meta', {}, api.message.html.meta(msg, { rawMessage })), |
29 | h('section.content', {}, opts.content), |
30 | h('section.raw-content', rawMessage) |
31 | ]) |
32 | } |
33 | } |
34 |
Built with git-ssb-web