aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/loading.js
blob: b9afc550fd8b7c5b6fa3874d0fdc2318d9b76839 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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