|
|
@ -1,23 +1,18 @@ |
|
|
|
const inherits = require('util').inherits |
|
|
|
const { Component } = require('react') |
|
|
|
const Component = require('react').Component |
|
|
|
|
|
|
|
const h = require('react-hyperscript') |
|
|
|
const h = require('react-hyperscript') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LoadingIndicator extends Component { |
|
|
|
inherits(LoadingIndicator, Component) |
|
|
|
renderMessage () { |
|
|
|
module.exports = LoadingIndicator |
|
|
|
const { loadingMessage } = this.props |
|
|
|
|
|
|
|
return loadingMessage && h('span', loadingMessage) |
|
|
|
function LoadingIndicator () { |
|
|
|
|
|
|
|
Component.call(this) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LoadingIndicator.prototype.render = function () { |
|
|
|
render () { |
|
|
|
const { isLoading, loadingMessage } = this.props |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
isLoading ? h('.full-flex-height', { |
|
|
|
h('.full-flex-height', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
left: '0px', |
|
|
|
left: '0px', |
|
|
|
zIndex: 10, |
|
|
|
zIndex: 50, |
|
|
|
position: 'absolute', |
|
|
|
position: 'absolute', |
|
|
|
flexDirection: 'column', |
|
|
|
flexDirection: 'column', |
|
|
|
display: 'flex', |
|
|
|
display: 'flex', |
|
|
@ -34,12 +29,10 @@ LoadingIndicator.prototype.render = function () { |
|
|
|
|
|
|
|
|
|
|
|
h('br'), |
|
|
|
h('br'), |
|
|
|
|
|
|
|
|
|
|
|
showMessageIfAny(loadingMessage), |
|
|
|
this.renderMessage(), |
|
|
|
]) : null |
|
|
|
]) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function showMessageIfAny (loadingMessage) { |
|
|
|
|
|
|
|
if (!loadingMessage) return null |
|
|
|
|
|
|
|
return h('span', loadingMessage) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = LoadingIndicator |
|
|
|