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

Convert Alert component to use JSX ()

This commit is contained in:
Whymarrh Whitby 2019-11-24 19:10:16 -03:30 committed by GitHub
parent 666277b4fa
commit 22a2d21796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,12 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
import classnames from 'classnames'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
class Alert extends Component {
constructor (props) {
super(props)
this.state = {
visble: false,
msg: false,
className: '',
}
state = {
visible: false,
msg: false,
className: '',
}
componentWillReceiveProps (nextProps) {
@ -26,14 +21,14 @@ class Alert extends Component {
this.setState({
msg: props.msg,
visible: true,
className: '.visible',
className: 'visible',
})
}
animateOut () {
this.setState({
msg: null,
className: '.hidden',
className: 'hidden',
})
setTimeout(_ => {
@ -45,9 +40,9 @@ class Alert extends Component {
render () {
if (this.state.visible) {
return (
h(`div.global-alert${this.state.className}`, {},
h('a.msg', {}, this.state.msg)
)
<div className={classnames('global-alert', this.state.className)}>
<a className="msg">{this.state.msg}</a>
</div>
)
}
return null