Commit 674a622e9b02a8a81e88a63f0a5f8ba74f9d2b7c
split example into multiple files (styles.css)
Matt McKegg committed on 2/12/2017, 3:45:43 PMParent: 3f235720442de3817c747a571687d2b98a9809cb
Files changed
example.js | deleted |
example/index.js | added |
example/styles.css | added |
example.js | ||
---|---|---|
@@ -1,39 +1,0 @@ | ||
1 | -const combine = require('depject') | |
2 | -const apply = require('depject/apply') | |
3 | -const h = require('mutant/h') | |
4 | - | |
5 | -const modules = require('./') | |
6 | -var api = entry(combine(modules)) | |
7 | - | |
8 | -// TODO depject.entry(sockets, { | |
9 | -// render_feed: 'first', | |
10 | -// feeds: { | |
11 | -// public: 'first' | |
12 | -// } | |
13 | -// })() | |
14 | - | |
15 | -require('insert-css')(` | |
16 | - .Message { | |
17 | - padding: 20px; | |
18 | - border-bottom: 1px solid #EEE; | |
19 | - } | |
20 | - | |
21 | - .Message > header.author { | |
22 | - font-weight: bold; | |
23 | - } | |
24 | -`) | |
25 | - | |
26 | -var app = h('div.App', [ | |
27 | - api.render_feed(api.feeds.public) | |
28 | -]) | |
29 | - | |
30 | -document.body.appendChild(app) | |
31 | - | |
32 | -function entry (sockets) { | |
33 | - return { | |
34 | - render_feed: apply.first(sockets.render_feed), | |
35 | - feeds: { | |
36 | - public: apply.first(sockets.feeds.public) | |
37 | - } | |
38 | - } | |
39 | -} |
example/index.js | ||
---|---|---|
@@ -1,0 +1,32 @@ | ||
1 … | +const combine = require('depject') | |
2 … | +const apply = require('depject/apply') | |
3 … | +const h = require('mutant/h') | |
4 … | +const fs = require('fs') | |
5 … | + | |
6 … | +const modules = require('../') | |
7 … | +var api = entry(combine(modules)) | |
8 … | + | |
9 … | +// TODO depject.entry(sockets, { | |
10 … | +// render_feed: 'first', | |
11 … | +// feeds: { | |
12 … | +// public: 'first' | |
13 … | +// } | |
14 … | +// })() | |
15 … | + | |
16 … | +require('insert-css')(fs.readFileSync(__dirname + '/styles.css', 'utf8')) | |
17 … | + | |
18 … | +var app = h('div.App', [ | |
19 … | + api.render_feed(api.feeds.public) | |
20 … | +]) | |
21 … | + | |
22 … | +document.head.appendChild(h('title', 'PATCHCORE :: Example')) | |
23 … | +document.body.appendChild(app) | |
24 … | + | |
25 … | +function entry (sockets) { | |
26 … | + return { | |
27 … | + render_feed: apply.first(sockets.render_feed), | |
28 … | + feeds: { | |
29 … | + public: apply.first(sockets.feeds.public) | |
30 … | + } | |
31 … | + } | |
32 … | +} |
example/styles.css | ||
---|---|---|
@@ -1,0 +1,27 @@ | ||
1 … | +body { | |
2 … | + font-family: caption, sans-serif | |
3 … | +} | |
4 … | + | |
5 … | +.Message { | |
6 … | + padding: 20px; | |
7 … | + border-bottom: 1px solid #EEE; | |
8 … | + position: relative; | |
9 … | +} | |
10 … | + | |
11 … | +.Message > header.author { | |
12 … | + font-weight: bold; | |
13 … | +} | |
14 … | + | |
15 … | +.Message.-mini { | |
16 … | + display: flex; | |
17 … | +} | |
18 … | + | |
19 … | +.Message.-mini > * { | |
20 … | + margin-right: 5px; | |
21 … | +} | |
22 … | + | |
23 … | +.Message > section.meta { | |
24 … | + position: absolute; | |
25 … | + right: 20px; | |
26 … | + top: 20px; | |
27 … | +} |
Built with git-ssb-web