1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/app/components/readonly-input.js
2017-10-13 13:23:10 -07:00

34 lines
666 B
JavaScript

const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
module.exports = ReadOnlyInput
inherits(ReadOnlyInput, Component)
function ReadOnlyInput () {
Component.call(this)
}
ReadOnlyInput.prototype.render = function () {
const {
wrapperClass = '',
inputClass = '',
value,
textarea,
onClick,
} = this.props
const inputType = textarea ? 'textarea' : 'input'
return h('div', {className: wrapperClass}, [
h(inputType, {
className: inputClass,
value,
readOnly: true,
onFocus: event => event.target.select(),
onClick,
}),
])
}