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

pull/9/head
Vasek Mlejnsky 6 years ago
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…
Cancel
Save