diff --git a/.babelrc b/.babelrc index a229be1..c4573be 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,4 @@ { "presets": ["env", "react"], - "plugins": ["transform-class-properties", "transform-object-rest-spread"] + "plugins": ["transform-class-properties", "transform-object-rest-spread", "syntax-dynamic-import"] } diff --git a/package.json b/package.json index 02f5f8d..9024dee 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "author": "Sara Vieira", "main": "dist/index.js", "dependencies": { - "react": "^16.4.0", - "react-dom": "^16.4.0", + "react": "^16.8.6", + "react-dom": "^16.8.6", + "react-scripts": "1.1.1", "react-youtube": "^7.6.0", "remcalc": "^1.0.10", "styled-is": "^1.1.3" @@ -27,8 +28,8 @@ }, "peerDependencies": { "prop-types": "^15.6.1", - "react": "^16.4.0", - "react-dom": "^16.4.0", + "react": "^16.8.6", + "react-dom": "^16.8.6", "react-scripts": "1.1.1", "styled-components": "^3.3.2" }, diff --git a/src/Components/Player.js b/src/Components/Player.js index f001ef9..465951a 100644 --- a/src/Components/Player.js +++ b/src/Components/Player.js @@ -1,9 +1,8 @@ -import React, { Component } from "react" +import React, { Component, Suspense, lazy } from "react" import styled from "styled-components" -import YouTube from "react-youtube" import is, { isNot } from "styled-is" -import remcalc from "remcalc" import PropTypes from "prop-types" +const YouTube = lazy(() => import('./Youtube')); import Play from "./Play" @@ -31,20 +30,6 @@ const VideoWrapper = styled.section` `}; ` -const Iframe = styled(YouTube)` - position: relative; - z-index: 3; - border: none; - transition: all 200ms ease; - height: 100%; - ${is("cinemaMode")` - height: ${remcalc(600)}; - @media (max-width: ${remcalc(768)}) { - height: auto; - } - `}; -` - const Thumbnail = styled.img` display: block; width: 100%; @@ -101,9 +86,10 @@ class Player extends Component {