UNPKG

ldx-widgets

Version:

widgets

68 lines (59 loc) 1.67 kB
(function() { var React, ReactDOM, Spin, Spinner, _, createClass; React = require('react'); createClass = require('create-react-class'); ReactDOM = require('react-dom'); Spin = require('spin'); _ = require('lodash'); Spinner = createClass({ defaults: { lines: 10, length: 5, width: 2, radius: 4, corners: 1, rotate: 0, direction: 1, color: '#000000', speed: 1, trail: 60, shadow: false, hwaccel: false, className: 'spinner', zIndex: 15 }, displayName: 'spinner', render: function() { var content, div, ref, ref1, spinnerText, table, tbody, td, textPosition, tr; ref = React.DOM, div = ref.div, table = ref.table, tbody = ref.tbody, tr = ref.tr, td = ref.td; ref1 = this.props, textPosition = ref1.textPosition, spinnerText = ref1.spinnerText; content = div({ ref: 'spinner', className: 'spinner-wrapper' }); if (spinnerText) { content = table({}, tbody({}, tr({}, [ td({ key: 'table-spinner', ref: 'spinner', className: 'spinner-wrapper right' }), td({ key: 'table-text' }, spinnerText) ]))); } return content; }, componentDidMount: function() { var props; props = _.clone(this.props); _.defaults(props, this.defaults); this.spinner = new Spin(props).spin(); return ReactDOM.findDOMNode(this.refs.spinner).appendChild(this.spinner.el); }, stop: function() { return this.spinner.stop(); } }); module.exports = Spinner; }).call(this);