You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
683 B
34 lines
683 B
import PropTypes from 'prop-types'
|
|
import React from 'react'
|
|
|
|
export default function ReadOnlyInput (props) {
|
|
const {
|
|
wrapperClass = '',
|
|
inputClass = '',
|
|
value,
|
|
textarea,
|
|
onClick,
|
|
} = props
|
|
|
|
const InputType = textarea ? 'textarea' : 'input'
|
|
|
|
return (
|
|
<div className={wrapperClass}>
|
|
<InputType
|
|
className={inputClass}
|
|
value={value}
|
|
readOnly
|
|
onFocus={(event) => event.target.select()}
|
|
onClick={onClick}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
ReadOnlyInput.propTypes = {
|
|
wrapperClass: PropTypes.string,
|
|
inputClass: PropTypes.string,
|
|
value: PropTypes.string,
|
|
textarea: PropTypes.bool,
|
|
onClick: PropTypes.func,
|
|
}
|
|
|