1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Convert LoadingScreen component to use JSX (#7545)

This commit is contained in:
Whymarrh Whitby 2019-11-24 17:51:50 -03:30 committed by GitHub
parent 04442318d3
commit 8311617b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,31 +1,33 @@
const { Component } = require('react')
const h = require('react-hyperscript')
import React, {Component} from 'react'
const PropTypes = require('prop-types')
const Spinner = require('../spinner')
class LoadingScreen extends Component {
static defaultProps = {
loadingMessage: null,
}
static propTypes = {
loadingMessage: PropTypes.string,
}
renderMessage () {
const { loadingMessage } = this.props
return loadingMessage && h('span', loadingMessage)
return loadingMessage
? <span>{loadingMessage}</span>
: null
}
render () {
return (
h('.loading-overlay', [
h('.loading-overlay__container', [
h(Spinner, {
color: '#F7C06C',
}),
this.renderMessage(),
]),
])
<div className="loading-overlay">
<div className="loading-overlay__container">
<Spinner color="#F7C06C" />
{this.renderMessage()}
</div>
</div>
)
}
}
LoadingScreen.propTypes = {
loadingMessage: PropTypes.string,
}
module.exports = LoadingScreen