UNPKG

3.6 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _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; }; }();
8
9var _react = require('react');
10
11var _react2 = _interopRequireDefault(_react);
12
13var _reactSlidySlider = require('./react-slidy-slider');
14
15var _reactSlidySlider2 = _interopRequireDefault(_reactSlidySlider);
16
17var _suiSpinner = require('@schibstedspain/sui-spinner');
18
19var _suiSpinner2 = _interopRequireDefault(_suiSpinner);
20
21var _reactLazyLoad = require('react-lazy-load');
22
23var _reactLazyLoad2 = _interopRequireDefault(_reactLazyLoad);
24
25function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
27function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
29function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
30
31function _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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
32
33var spinnerConfig = {
34 size: 20,
35 thickness: 2,
36 type: 'circle'
37};
38
39var lazyLoadOffsetVerical = 500;
40
41var ReactSlidy = function (_Component) {
42 _inherits(ReactSlidy, _Component);
43
44 function ReactSlidy() {
45 _classCallCheck(this, ReactSlidy);
46
47 return _possibleConstructorReturn(this, (ReactSlidy.__proto__ || Object.getPrototypeOf(ReactSlidy)).apply(this, arguments));
48 }
49
50 _createClass(ReactSlidy, [{
51 key: 'shouldComponentUpdate',
52
53 // as it's a slider, we don't want to re-render it and don't expect
54 // to add new childrens to it, so we don't want unexpected behaviour
55 value: function shouldComponentUpdate() {
56 return false;
57 }
58 }, {
59 key: 'render',
60 value: function render() {
61 return _react2.default.createElement(
62 'div',
63 { className: this.props.classNameBase },
64 _react2.default.createElement(_suiSpinner2.default, spinnerConfig),
65 _react2.default.createElement(
66 _reactLazyLoad2.default,
67 { offsetVertical: lazyLoadOffsetVerical },
68 _react2.default.createElement(
69 _reactSlidySlider2.default,
70 this.props,
71 this.props.children
72 )
73 )
74 );
75 }
76 }]);
77
78 return ReactSlidy;
79}(_react.Component);
80
81exports.default = ReactSlidy;
82
83
84ReactSlidy.propTypes = {
85 children: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object]).isRequired,
86 classNameBase: _react.PropTypes.string
87};
88
89ReactSlidy.defaultProps = {
90 classNameBase: 'react-Slidy'
91};
\No newline at end of file