From 7d4ca8eeedabe286755c6d834231f5c25fec26e2 Mon Sep 17 00:00:00 2001 From: Vasek Mlejnsky Date: Mon, 24 Sep 2018 11:37:51 +0200 Subject: [PATCH] Change textarea style based on its state prop --- src/components/Textarea/index.js | 42 +++++++++++++++---- .../components/AdvancedForm/index.js | 14 ++++++- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/components/Textarea/index.js b/src/components/Textarea/index.js index 6c4edd45..2d21bebf 100644 --- a/src/components/Textarea/index.js +++ b/src/components/Textarea/index.js @@ -15,10 +15,11 @@ const disabledColor = colors.TEXT_PRIMARY; const TextArea = styled.textarea` width: 100%; + min-height: 85px; + margin-bottom: 10px; padding: 6px 12px; box-sizing: border-box; - min-height: 25px; - border: ${props => (props.isError ? `1px solid ${colors.ERROR_PRIMARY}` : `1px solid ${colors.DIVIDER}`)}; + border: 1px solid ${props => (props.borderColor ? props.borderColor : colors.DIVIDER)}; border-radius: 2px; resize: none; outline: none; @@ -87,6 +88,23 @@ const TopLabel = styled.span` color: ${colors.TEXT_SECONDARY}; `; +const BottomText = styled.span` + font-size: ${FONT_SIZE.SMALLER}; + color: ${props => (props.color ? props.color : colors.TEXT_SECONDARY)}; +`; + +const getColor = (inputState) => { + let color = ''; + if (inputState === 'success') { + color = colors.SUCCESS_PRIMARY; + } else if (inputState === 'warning') { + color = colors.WARNING_PRIMARY; + } else if (inputState === 'error') { + color = colors.ERROR_PRIMARY; + } + return color; +}; + const Textarea = ({ className, placeholder = '', @@ -96,15 +114,17 @@ const Textarea = ({ onBlur, isDisabled, onChange, - isError, topLabel, + state = '', + bottomText = '', }) => ( - + {topLabel && ( {topLabel} )}