UNPKG

@attivio/suit

Version:

Attivio SUIT, the Search UI Toolkit, is a library for creating search clients for searching the Attivio platform.

82 lines (68 loc) 3.1 kB
var _class, _temp; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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; } 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable react/no-string-refs */ import React from 'react'; import ReactSwipe from 'react-swipe'; import { Row, Col, Glyphicon } from 'react-bootstrap'; var SwipeViews = (_temp = _class = function (_React$Component) { _inherits(SwipeViews, _React$Component); function SwipeViews(props) { _classCallCheck(this, SwipeViews); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.next = _this.next.bind(_this); _this.prev = _this.prev.bind(_this); return _this; } SwipeViews.prototype.next = function next() { this.refs.reactSwipe.next(); }; SwipeViews.prototype.prev = function prev() { this.refs.reactSwipe.prev(); }; SwipeViews.prototype.render = function render() { var swipeOptions = { startSlide: this.props.startSlide, auto: this.props.auto, speed: this.props.speed, disableScroll: this.props.disableScroll, continuous: this.props.continuous }; return React.createElement( Row, null, React.createElement( Col, { xs: 12, sm: 12, md: 12, lg: 12, className: 'swipe-view-container' }, React.createElement( Col, { xs: 1, sm: 1, md: 1, lg: 1 }, React.createElement(Glyphicon, { className: 'swipe-view-navigation-button', glyph: 'chevron-left', onClick: this.prev }) ), React.createElement( Col, { xs: 10, sm: 10, md: 10, lg: 10, style: { textAlign: 'center' } }, React.createElement( ReactSwipe, { key: this.props.views, ref: 'reactSwipe', swipeOptions: { swipeOptions: swipeOptions } }, this.props.views ) ), React.createElement( Col, { xs: 1, sm: 1, md: 1, lg: 1 }, React.createElement(Glyphicon, { className: 'swipe-view-navigation-button', glyph: 'chevron-right', onClick: this.next }) ) ) ); }; return SwipeViews; }(React.Component), _class.defaultProps = { continuous: true, startSlide: 0, auto: 3000, speed: 10, disableScroll: false }, _class.displayName = 'SwipeViews', _temp); export default SwipeViews;