mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-17 18:42:01 +00:00
Add prop that can add elements on top of input/textarea
This commit is contained in:
parent
bcb343deff
commit
5984ad047f
@ -86,6 +86,11 @@ const TextArea = styled.textarea`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const TopLabel = styled.span`
|
||||||
|
padding-bottom: 4px;
|
||||||
|
color: ${colors.TEXT_SECONDARY};
|
||||||
|
`;
|
||||||
|
|
||||||
const Textarea = ({
|
const Textarea = ({
|
||||||
className,
|
className,
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
@ -96,11 +101,11 @@ const Textarea = ({
|
|||||||
isDisabled,
|
isDisabled,
|
||||||
onChange,
|
onChange,
|
||||||
isError,
|
isError,
|
||||||
label,
|
topLabel,
|
||||||
}) => (
|
}) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{label && (
|
{topLabel && (
|
||||||
<Label>{label}</Label>
|
<TopLabel>{topLabel}</TopLabel>
|
||||||
)}
|
)}
|
||||||
<TextArea
|
<TextArea
|
||||||
className={className}
|
className={className}
|
||||||
@ -126,7 +131,7 @@ Textarea.propTypes = {
|
|||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
isDisabled: PropTypes.bool,
|
isDisabled: PropTypes.bool,
|
||||||
label: PropTypes.string,
|
topLabel: PropTypes.node,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Textarea;
|
export default Textarea;
|
||||||
|
@ -28,7 +28,7 @@ const InputIconWrapper = styled.div`
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const InputLabel = styled.span`
|
const TopLabel = styled.span`
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
color: ${colors.TEXT_SECONDARY};
|
color: ${colors.TEXT_SECONDARY};
|
||||||
`;
|
`;
|
||||||
@ -102,8 +102,8 @@ class Input extends Component {
|
|||||||
<Wrapper
|
<Wrapper
|
||||||
className={this.props.className}
|
className={this.props.className}
|
||||||
>
|
>
|
||||||
{this.props.inputLabel && (
|
{this.props.topLabel && (
|
||||||
<InputLabel>{this.props.inputLabel}</InputLabel>
|
<TopLabel>{this.props.topLabel}</TopLabel>
|
||||||
)}
|
)}
|
||||||
<InputWrapper>
|
<InputWrapper>
|
||||||
<InputIconWrapper>
|
<InputIconWrapper>
|
||||||
@ -153,7 +153,7 @@ Input.propTypes = {
|
|||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
state: PropTypes.string,
|
state: PropTypes.string,
|
||||||
bottomText: PropTypes.string,
|
bottomText: PropTypes.string,
|
||||||
inputLabel: PropTypes.string,
|
topLabel: PropTypes.node,
|
||||||
sideAddons: PropTypes.arrayOf(PropTypes.node),
|
sideAddons: PropTypes.arrayOf(PropTypes.node),
|
||||||
isDisabled: PropTypes.bool,
|
isDisabled: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user