Skip to content

Commit

Permalink
feat: Implement minLength and maxLength on TextArea. (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
goloroden authored May 17, 2020
1 parent ec977c1 commit 9a858c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/components/input/TextArea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ interface TextAreaProps {
className?: string;
disabled?: boolean;
id?: string;
maxLength?: number;
minLength?: number;
name?: string;
placeholder?: string;
ref?: any;
Expand All @@ -30,6 +32,8 @@ const TextArea: FunctionComponent<TextAreaProps> = ({
disabled = false,
focusDelay = 0,
id,
maxLength = Number.MAX_SAFE_INTEGER,
minLength = 0,
name,
value,
placeholder,
Expand Down Expand Up @@ -65,6 +69,8 @@ const TextArea: FunctionComponent<TextAreaProps> = ({
ref={ elementRef }
className={ componentClasses }
disabled={ disabled }
maxLength={ maxLength }
minLength={ minLength }
name={ name }
value={ value }
onBlur={ onBlur }
Expand Down
4 changes: 4 additions & 0 deletions lib/components/input/TextArea/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const styles = (theme: Theme): ComponentClassNames<TextAreaClassNames> => ({
border: `1px solid`,
borderColor: theme.color.content.border,

'&:invalid': {
borderColor: `${theme.color.interaction.error} !important`
},

'&:focus': {
outline: 'none',
borderColor: theme.color.interaction.focus
Expand Down

0 comments on commit 9a858c5

Please sign in to comment.