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 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>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user