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