1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-05-11 11:28:46 +00:00

Merge pull request #266 from trezor/sign-and-verify-readonly

Sign and verify readonly
This commit is contained in:
Vladimir Volek 2018-12-10 17:05:00 +01:00 committed by GitHub
commit c33b56bfcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 9 deletions

View File

@ -57,6 +57,11 @@ const StyledTextarea = styled(Textarea)`
opacity: 1; opacity: 1;
} }
&:read-only {
background: ${colors.GRAY_LIGHT};
color: ${colors.TEXT_SECONDARY};
}
&:disabled { &:disabled {
pointer-events: none; pointer-events: none;
background: ${colors.GRAY_LIGHT}; background: ${colors.GRAY_LIGHT};
@ -150,11 +155,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 +176,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 +185,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 +211,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,

View File

@ -62,6 +62,11 @@ const StyledInput = styled.input`
color: ${colors.TEXT_SECONDARY}; color: ${colors.TEXT_SECONDARY};
} }
&:read-only {
background: ${colors.GRAY_LIGHT};
color: ${colors.TEXT_SECONDARY};
}
${props => props.trezorAction && css` ${props => props.trezorAction && css`
z-index: 10001; z-index: 10001;
position: relative; /* bigger than modal container */ position: relative; /* bigger than modal container */
@ -95,7 +100,7 @@ const Overlay = styled.div`
height: 100%; height: 100%;
background-image: linear-gradient(to right, background-image: linear-gradient(to right,
rgba(0,0,0, 0) 0%, rgba(0,0,0, 0) 0%,
rgba(255,255,255, 1) 220px rgba(249,249,249, 1) 220px
); );
`} `}
`; `;

View File

@ -65,13 +65,13 @@ const EyeButton = styled(Button)`
z-index: 10001; z-index: 10001;
padding: 0; padding: 0;
width: 30px; width: 30px;
background: white; background: transparent;
top: 5px; top: 5px;
position: absolute; position: absolute;
right: 10px; right: 10px;
&:hover { &:hover {
background: white; background: transparent;
} }
`; `;

View File

@ -86,7 +86,7 @@ class SignVerify extends Component <Props> {
type="text" type="text"
isSmallText isSmallText
autoSelect autoSelect
isDisabled readOnly
/> />
</Row> </Row>
<Row> <Row>
@ -97,7 +97,7 @@ class SignVerify extends Component <Props> {
onChange={this.handleInputChange} onChange={this.handleInputChange}
rows={4} rows={4}
maxRows={4} maxRows={4}
maxLength="255" maxLength={255}
/> />
</Row> </Row>
<Row> <Row>
@ -108,8 +108,8 @@ class SignVerify extends Component <Props> {
rows={4} rows={4}
autoSelect autoSelect
maxRows={4} maxRows={4}
maxLength="255" maxLength={255}
isDisabled readOnly
/> />
</Row> </Row>
<RowButtons> <RowButtons>
@ -146,7 +146,7 @@ class SignVerify extends Component <Props> {
onChange={this.handleInputChange} onChange={this.handleInputChange}
rows={4} rows={4}
maxRows={4} maxRows={4}
maxLength="255" maxLength={255}
/> />
</Row> </Row>
<Row> <Row>
@ -158,7 +158,7 @@ class SignVerify extends Component <Props> {
onChange={this.handleInputChange} onChange={this.handleInputChange}
rows={4} rows={4}
maxRows={4} maxRows={4}
maxLength="255" maxLength={255}
/> />
</Row> </Row>
<RowButtons> <RowButtons>