Files: 623ff906a993e064e9317ffbb5d9040bb68b975e / building / components / branchPlacard.js
734 bytesRaw
1 | const html = require('nanohtml') |
2 | const raw = require('nanohtml/raw') |
3 | const md = require('markdown-it')() |
4 | |
5 | const button = require('./actionButtons') |
6 | |
7 | module.exports = view |
8 | |
9 | function view (state, emit) { |
10 | if (state.branch.title) { |
11 | var branch = state.branch |
12 | console.log({branch}) |
13 | return html` |
14 | <section id='branch-placard'> |
15 | <h1>${branch.title}</h1> |
16 | ${render(branch.description)} |
17 | <p>Want to start your own zine library?<span> ${button.makeBranch()}</span></p> |
18 | </section> |
19 | ` |
20 | } else { |
21 | return html`<h1>loading</h1>` |
22 | } |
23 | } |
24 | |
25 | function render (text) { |
26 | var htmlFromMarkdown = md.render(text) |
27 | var compatibleHTML = raw(htmlFromMarkdown) |
28 | return html`<article>${compatibleHTML}</article>` |
29 | } |
30 |
Built with git-ssb-web