Replace `ReadOnlyInput` (#14330)
Replace the last two uses of the `ReadOnlyInput` with a div. The idea of using an input for read-only data is silly. We can just put it in the DOM directly instead.feature/default_network_editable
parent
1582efdc06
commit
4bcb48df53
@ -1 +0,0 @@ |
||||
export { default } from './readonly-input'; |
@ -1,8 +0,0 @@ |
||||
.readonly-input { |
||||
&__input { |
||||
direction: ltr; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
width: 100%; |
||||
} |
||||
} |
@ -1,38 +0,0 @@ |
||||
import PropTypes from 'prop-types'; |
||||
import React from 'react'; |
||||
import classnames from 'classnames'; |
||||
|
||||
export default function ReadOnlyInput(props) { |
||||
const { |
||||
wrapperClass = '', |
||||
inputClass = '', |
||||
value, |
||||
textarea, |
||||
onClick, |
||||
autoFocus = false, |
||||
} = props; |
||||
|
||||
const InputType = textarea ? 'textarea' : 'input'; |
||||
|
||||
return ( |
||||
<div className={classnames('readonly-input', wrapperClass)}> |
||||
<InputType |
||||
className={classnames('readonly-input__input', inputClass)} |
||||
value={value} |
||||
readOnly |
||||
onFocus={(event) => event.target.select()} |
||||
onClick={onClick} |
||||
autoFocus={autoFocus} |
||||
/> |
||||
</div> |
||||
); |
||||
} |
||||
|
||||
ReadOnlyInput.propTypes = { |
||||
wrapperClass: PropTypes.string, |
||||
inputClass: PropTypes.string, |
||||
value: PropTypes.string, |
||||
textarea: PropTypes.bool, |
||||
onClick: PropTypes.func, |
||||
autoFocus: PropTypes.bool, |
||||
}; |
Loading…
Reference in new issue