UNPKG

@bigfishtv/cockpit

Version:

70 lines (59 loc) 2.42 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; } import React, { Component } from 'react'; import Icon from '../Icon'; /** * Dumb asset cell for an audio file */ var AudioCell = (_temp = _class = function (_Component) { _inherits(AudioCell, _Component); function AudioCell() { _classCallCheck(this, AudioCell); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } AudioCell.prototype.render = function render() { var _props = this.props, cellSize = _props.cellSize, title = _props.title, filename = _props.filename, extension = _props.extension, url = _props.url; return React.createElement( 'div', { className: 'media media-1' }, React.createElement( 'div', { className: 'media-inner' }, cellSize == 'small' ? React.createElement(Icon, { name: 'volume-up', size: '24' }) : React.createElement( 'audio', { controls: true, ref: 'media', style: { width: '170%', transform: 'scale(0.6)', boxShadow: '5px 5px 8px rgba(0,0, 0, 0.1)', borderRadius: 50 } }, React.createElement('source', { src: url, type: 'audio/' + extension }) ), cellSize !== 'small' && React.createElement( 'span', { className: 'media-inner-title' }, React.createElement( 'a', { href: url, target: '_blank' }, title || filename ) ) ) ); }; return AudioCell; }(Component), _class.defaultProps = { title: '', cellSize: 'default' }, _temp); export { AudioCell as default };