Convert ReadOnlyInput component to use JSX (#7512)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent 1454426e3e
commit a3d0b71320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      ui/app/components/ui/readonly-input.js

@ -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>
)
}

Loading…
Cancel
Save