Skip to content

Commit

Permalink
refs micnews#24 - re-introduce deku as virtual-element was breaking a…
Browse files Browse the repository at this point in the history
…rticle-json-to-fbia rendering
  • Loading branch information
nazar committed Jun 14, 2016
1 parent e351b45 commit c1d9b40
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/render-iframe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable deku/no-unknown-property */
import element from 'virtual-element';
import {element} from 'deku';

export default ({src, width, height, allowFullscreen}) =>
<iframe
Expand Down
2 changes: 1 addition & 1 deletion lib/render-text.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import element from 'virtual-element';
import {element} from 'deku';

export default text =>
(text || []).map(({content, href}) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/types/facebook.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const type = 'facebook';
import element from 'virtual-element';
import {element} from 'deku';
import parseText from '../parse-text';
import renderText from '../render-text';
import parseInput from '../parse-input';
Expand Down
2 changes: 1 addition & 1 deletion lib/types/image.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getDimensions from '../dimensions';
import element from 'virtual-element';
import {element} from 'deku';

export const parse = ([elm]) => {
const tagName = elm.tagName.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion lib/types/instagram/render.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable deku/no-unknown-property */
// ^^^ is needed to not get errors around datetime="" below

import element from 'virtual-element';
import {element} from 'deku';

const renderWithCaption = ({url, text, user, date}) =>
(<blockquote class='instagram-media' data-instgrm-captioned data-instgrm-version='6' style=' background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);'>
Expand Down
2 changes: 1 addition & 1 deletion lib/types/twitter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import find from 'lodash.find';
import last from 'lodash.last';
import element from 'virtual-element';
import {element} from 'deku';
import parseText from '../parse-text';
import renderText from '../render-text';

Expand Down
2 changes: 1 addition & 1 deletion lib/types/video.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import getDimensions from '../dimensions';
import map from 'lodash.map';
import element from 'virtual-element';
import {element} from 'deku';

const type = 'video';

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"babelify": "^7.2.0",
"brfs": "^1.4.3",
"browserify": "^13.0.0",
"deku": "^1.0.0",
"electron-prebuilt": "^0.37.7",
"faucet": "0.0.1",
"hyperscript": "^1.4.7",
Expand All @@ -49,13 +48,13 @@
},
"dependencies": {
"embedly-url": "^1.0.0",
"deku": "^2.0.0-rc16",
"get-youtube-id": "^1.0.0",
"lodash.find": "^4.2.0",
"lodash.foreach": "^4.2.0",
"lodash.last": "^3.0.0",
"lodash.map": "^4.2.1",
"lodash.startswith": "^4.0.0",
"lodash.values": "^4.1.0",
"virtual-element": "^1.2.0"
"lodash.values": "^4.1.0"
}
}
4 changes: 2 additions & 2 deletions test/parse-render-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from './tape-wrapper';

import fixtures from './fixtures';
import {render, parse as _parse} from '../lib';
import {renderString, tree} from 'deku';
import {string} from 'deku';
import queryDom from 'query-dom';

const parse = process.browser
Expand All @@ -14,7 +14,7 @@ const parse = process.browser
: str => _parse(queryDom(str));

const parseAndRender = input =>
renderString(tree(render(parse(input))));
string.render(render(parse(input)));

test('parse() + render() facebook - post', t => {
const input = fixtures.facebookPost;
Expand Down
4 changes: 2 additions & 2 deletions test/render-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import test from './tape-wrapper';
import {render as _render} from '../lib';
import tsml from 'tsml';
import {renderString, tree} from 'deku';
import {string} from 'deku';
import fixtures from './fixtures';
import renderText from '../lib/render-text';

const render = opts => renderString(tree(_render(opts)));
const render = opts => string.render(_render(opts));

test('render() img', t => {
const actual = render({
Expand Down

0 comments on commit c1d9b40

Please sign in to comment.