1
0
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:
Whymarrh Whitby 2020-01-13 11:42:11 -03:30 committed by GitHub
parent 3b3325d191
commit 789dd19677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,22 +2,25 @@ import PropTypes from 'prop-types'
import React, { Component } from 'react'
import classnames from 'classnames'
import { inherits } from 'util'
import NetworkDropdownIcon from './dropdowns/components/network-dropdown-icon'
Network.contextTypes = {
export default class Network extends Component {
static contextTypes = {
t: PropTypes.func,
}
export default Network
inherits(Network, Component)
function Network () {
Component.call(this)
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,
}
Network.prototype.render = function Network () {
render () {
const context = this.context
const networkNumber = this.props.network
let providerName, providerNick, providerUrl
@ -174,3 +177,4 @@ Network.prototype.render = function Network () {
</div>
)
}
}