mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert Network component to an ES6 class (#7784)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This commit is contained in:
parent
3b3325d191
commit
789dd19677
@ -2,22 +2,25 @@ import PropTypes from 'prop-types'
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { inherits } from 'util'
|
|
||||||
import NetworkDropdownIcon from './dropdowns/components/network-dropdown-icon'
|
import NetworkDropdownIcon from './dropdowns/components/network-dropdown-icon'
|
||||||
|
|
||||||
Network.contextTypes = {
|
export default class Network extends Component {
|
||||||
|
static contextTypes = {
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Network
|
static propTypes = {
|
||||||
|
network: PropTypes.string.isRequired,
|
||||||
|
provider: PropTypes.shape({
|
||||||
|
type: PropTypes.string,
|
||||||
|
nickname: PropTypes.string,
|
||||||
|
rpcTarget: PropTypes.string,
|
||||||
|
}).isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
onClick: PropTypes.func.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
inherits(Network, Component)
|
render () {
|
||||||
|
|
||||||
function Network () {
|
|
||||||
Component.call(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
Network.prototype.render = function Network () {
|
|
||||||
const context = this.context
|
const context = this.context
|
||||||
const networkNumber = this.props.network
|
const networkNumber = this.props.network
|
||||||
let providerName, providerNick, providerUrl
|
let providerName, providerNick, providerUrl
|
||||||
@ -173,4 +176,5 @@ Network.prototype.render = function Network () {
|
|||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user