UNPKG

react-kube

Version:

Kube CSS in React Components

74 lines (55 loc) 3.34 kB
"use strict"; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _classnames = require("classnames"); var _classnames2 = _interopRequireDefault(_classnames); var VideoPlayer = (function (_React$Component) { function VideoPlayer() { _classCallCheck(this, VideoPlayer); if (_React$Component != null) { _React$Component.apply(this, arguments); } } _inherits(VideoPlayer, _React$Component); _createClass(VideoPlayer, [{ key: "render", value: function render() { var videoClasses = (0, _classnames2["default"])({ "video-wrapper": true }); var frameStyles = { height: this.props.height ? this.props.height : "100%", width: this.props.width ? this.props.width : "100%" }; this.props.youtube ? this.props.youtube = "http://www.youtube.com/embed/" + this.props.youtube : null; //eslint-disable-line this.props.vimeo ? this.props.vimeo = "https://player.vimeo.com/video/" + this.props.vimeo : null; //eslint-disable-line return _react2["default"].createElement( "div", { className: (0, _classnames2["default"])(this.props.className, videoClasses), style: this.props.style }, _react2["default"].createElement("iframe", { allowFullScreen: this.props.noFullscreen ? false : true, mozallowfullscreen: this.props.noFullscreen ? false : true, src: this.props.url ? this.props.url : this.props.youtube ? this.props.youtube : this.props.vimeo, style: frameStyles, webkitAllowFullScreen: this.props.noFullscreen ? false : true }) ); } }]); return VideoPlayer; })(_react2["default"].Component); VideoPlayer.propTypes = { className: _react2["default"].PropTypes.string, height: _react2["default"].PropTypes.string, noFullscreen: _react2["default"].PropTypes.boolean, style: _react2["default"].PropTypes.object, url: _react2["default"].PropTypes.string, vimeo: _react2["default"].PropTypes.string, width: _react2["default"].PropTypes.string, youtube: _react2["default"].PropTypes.string }; VideoPlayer.defaultProps = { small: false }; module.exports = VideoPlayer;