From 8c768c19ce3e3b7bb61344cc8c77a54e10641c6d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 5 Jul 2018 12:37:53 +0300 Subject: transform-object-rest-spread --- vnext/package.json | 7 +++++ vnext/src/components/Message.js | 62 ++++++++++++++++++++--------------------- vnext/src/components/Thread.js | 9 +++--- vnext/yarn.lock | 9 +++++- 4 files changed, 49 insertions(+), 38 deletions(-) diff --git a/vnext/package.json b/vnext/package.json index 27aec38b..ad007a81 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -15,6 +15,7 @@ "babel-jest": "^23.2.0", "babel-loader": "^7.1.4", "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-preset-react": "^6.24.1", "connect-history-api-fallback": "^1.5.0", @@ -45,6 +46,12 @@ { "spec": true } + ], + [ + "transform-object-rest-spread", + { + "useBuiltIns": true + } ] ], "presets": [ diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index 585ae1ac..273e035c 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -9,52 +9,50 @@ import Avatar from './Avatar'; import { format } from '../utils/embed'; -export default function Message(props) { - const msg = props.data; - const visitor = props.visitor; +export default function Message({ data, visitor, children, ...rest }) { return (
- +
- -
- +
-

= 0) }}>

+

= 0) }}>

- {msg.photo && -

- + {data.photo && +

+

} - {props.children} + { children }
); } -function Tags(props) { - return props.data && props.data.map(tag => { - return ({tag}) +function Tags({ data, user, ...rest}) { + return data && data.map(tag => { + return ({tag}) }) } diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 0ec39d11..3de16a64 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -159,12 +159,11 @@ const linkStyle = { cursor: 'pointer' } -function Recommendations(props) { - const recomms = props.src; - return recomms && ( -
{`Recommended by (${recomms.length}): `} +function Recommendations({src, ...rest}) { + return src && ( +
{`Recommended by (${src.length}): `} { - recomms.map(it => ( + src.map(it => ( {it} )).reduce((prev, curr) => [prev, ', ', curr]) } diff --git a/vnext/yarn.lock b/vnext/yarn.lock index 3953d8d7..c99a46a2 100644 --- a/vnext/yarn.lock +++ b/vnext/yarn.lock @@ -683,7 +683,7 @@ babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" -babel-plugin-syntax-object-rest-spread@^6.13.0: +babel-plugin-syntax-object-rest-spread@^6.13.0, babel-plugin-syntax-object-rest-spread@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" @@ -891,6 +891,13 @@ babel-plugin-transform-flow-strip-types@^6.22.0: babel-plugin-syntax-flow "^6.18.0" babel-runtime "^6.22.0" +babel-plugin-transform-object-rest-spread@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06" + dependencies: + babel-plugin-syntax-object-rest-spread "^6.8.0" + babel-runtime "^6.26.0" + babel-plugin-transform-react-display-name@^6.23.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.25.0.tgz#67e2bf1f1e9c93ab08db96792e05392bf2cc28d1" -- cgit v1.2.3