1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 01:08:27 +00:00

Add prop that can add elements on top of input/textarea

This commit is contained in:
Vasek Mlejnsky 2018-09-05 10:57:14 +02:00
parent bcb343deff
commit 5984ad047f
2 changed files with 13 additions and 8 deletions

View File

@ -86,6 +86,11 @@ const TextArea = styled.textarea`
}
`;
const TopLabel = styled.span`
padding-bottom: 4px;
color: ${colors.TEXT_SECONDARY};
`;
const Textarea = ({
className,
placeholder = '',
@ -96,11 +101,11 @@ const Textarea = ({
isDisabled,
onChange,
isError,
label,
topLabel,
}) => (
<Wrapper>
{label && (
<Label>{label}</Label>
{topLabel && (
<TopLabel>{topLabel}</TopLabel>
)}
<TextArea
className={className}
@ -126,7 +131,7 @@ Textarea.propTypes = {
placeholder: PropTypes.string,
value: PropTypes.string,
isDisabled: PropTypes.bool,
label: PropTypes.string,
topLabel: PropTypes.node,
};
export default Textarea;

View File

@ -28,7 +28,7 @@ const InputIconWrapper = styled.div`
display: inline-block;
`;
const InputLabel = styled.span`
const TopLabel = styled.span`
padding-bottom: 4px;
color: ${colors.TEXT_SECONDARY};
`;
@ -102,8 +102,8 @@ class Input extends Component {
<Wrapper
className={this.props.className}
>
{this.props.inputLabel && (
<InputLabel>{this.props.inputLabel}</InputLabel>
{this.props.topLabel && (
<TopLabel>{this.props.topLabel}</TopLabel>
)}
<InputWrapper>
<InputIconWrapper>
@ -153,7 +153,7 @@ Input.propTypes = {
onChange: PropTypes.func,
state: PropTypes.string,
bottomText: PropTypes.string,
inputLabel: PropTypes.string,
topLabel: PropTypes.node,
sideAddons: PropTypes.arrayOf(PropTypes.node),
isDisabled: PropTypes.bool,
};