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