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

Convert ReadOnlyInput component to use JSX (#7512)

This commit is contained in:
Whymarrh Whitby 2019-11-23 00:44:44 -03:30 committed by GitHub
parent 1454426e3e
commit a3d0b71320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,4 @@
const Component = require('react').Component
const h = require('react-hyperscript')
import React, { Component } from 'react'
const inherits = require('util').inherits
module.exports = ReadOnlyInput
@ -9,7 +8,7 @@ function ReadOnlyInput () {
Component.call(this)
}
ReadOnlyInput.prototype.render = function () {
ReadOnlyInput.prototype.render = function ReadOnlyInput () {
const {
wrapperClass = '',
inputClass = '',
@ -18,16 +17,18 @@ ReadOnlyInput.prototype.render = function () {
onClick,
} = this.props
const inputType = textarea ? 'textarea' : 'input'
const InputType = textarea ? 'textarea' : 'input'
return h('div', {className: wrapperClass}, [
h(inputType, {
className: inputClass,
value,
readOnly: true,
onFocus: event => event.target.select(),
onClick,
}),
])
return (
<div className={wrapperClass}>
<InputType
className={inputClass}
value={value}
readOnly
onFocus={event => event.target.select()}
onClick={onClick}
/>
</div>
)
}