1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 19:10:22 +01:00
metamask-extension/ui/app/components/readonly-input.js

34 lines
666 B
JavaScript
Raw Normal View History

2017-09-20 03:16:51 +02:00
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 = '',
2017-09-20 03:16:51 +02:00
value,
textarea,
onClick,
2017-09-20 03:16:51 +02:00
} = this.props
const inputType = textarea ? 'textarea' : 'input'
2017-09-20 03:16:51 +02:00
return h('div', {className: wrapperClass}, [
h(inputType, {
2017-09-20 03:16:51 +02:00
className: inputClass,
value,
readOnly: true,
onFocus: event => event.target.select(),
onClick,
2017-09-20 03:16:51 +02:00
}),
])
}