1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

added readOnly property and styles to textarea component

This commit is contained in:
slowbackspace 2018-12-06 19:31:53 +01:00
parent 2eb6785b0d
commit a94d949ad4

View File

@ -57,6 +57,16 @@ const StyledTextarea = styled(Textarea)`
opacity: 1; opacity: 1;
} }
&:read-only {
background: ${colors.GRAY_LIGHT};
color: ${colors.TEXT_SECONDARY};
&::placeholder {
color: ${disabledColor};
opacity: 1;
}
}
&:disabled { &:disabled {
pointer-events: none; pointer-events: none;
background: ${colors.GRAY_LIGHT}; background: ${colors.GRAY_LIGHT};
@ -150,11 +160,13 @@ const TextArea = ({
onFocus, onFocus,
onBlur, onBlur,
isDisabled, isDisabled,
readOnly,
name, name,
onChange, onChange,
topLabel, topLabel,
rows, rows,
maxRows, maxRows,
maxLength,
autoSelect, autoSelect,
state = '', state = '',
bottomText = '', bottomText = '',
@ -169,6 +181,7 @@ const TextArea = ({
autoCorrect="off" autoCorrect="off"
autoCapitalize="off" autoCapitalize="off"
maxRows={maxRows} maxRows={maxRows}
maxLength={maxLength}
rows={rows} rows={rows}
className={className} className={className}
disabled={isDisabled} disabled={isDisabled}
@ -177,6 +190,7 @@ const TextArea = ({
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur} onBlur={onBlur}
value={value} value={value}
readOnly={readOnly}
onClick={autoSelect ? event => event.target.select() : null} onClick={autoSelect ? event => event.target.select() : null}
placeholder={placeholder} placeholder={placeholder}
onChange={onChange} onChange={onChange}
@ -202,7 +216,9 @@ TextArea.propTypes = {
customStyle: PropTypes.string, customStyle: PropTypes.string,
placeholder: PropTypes.string, placeholder: PropTypes.string,
value: PropTypes.string, value: PropTypes.string,
readOnly: PropTypes.bool,
maxRows: PropTypes.number, maxRows: PropTypes.number,
maxLength: PropTypes.number,
rows: PropTypes.number, rows: PropTypes.number,
name: PropTypes.string, name: PropTypes.string,
isDisabled: PropTypes.bool, isDisabled: PropTypes.bool,