aboutsummaryrefslogblamecommitdiffstats
path: root/ui/app/components/loading.js
blob: b9afc550fd8b7c5b6fa3874d0fdc2318d9b76839 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
                                      
                                      
                                       
                                        
 







                                                      






                                                                                         
 

                               


        

 

                                   
                             

 
                                 
const { Component } = require('react')
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const classnames = require('classnames')

class LoadingIndicator extends Component {
  renderMessage () {
    const { loadingMessage } = this.props
    return loadingMessage && h('span', loadingMessage)
  }

  render () {
    return (
      h('.loading-overlay', {
        className: classnames({ 'loading-overlay--full-screen': this.props.fullScreen }),
      }, [
        h('.flex-center.flex-column', [
          h('img', {
            src: 'images/loading.svg',
          }),

          this.renderMessage(),
        ]),
      ])
    )
  }
}

LoadingIndicator.propTypes = {
  loadingMessage: PropTypes.string,
  fullScreen: PropTypes.bool,
}

module.exports = LoadingIndicator