Skip to content

Commit

Permalink
feat: change validOutline to a utility prop + control valid state fro…
Browse files Browse the repository at this point in the history
…m inside the component
  • Loading branch information
R-romero committed Jan 26, 2022
1 parent d5f215f commit bbad56e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
search: inputType === 'search',
hasIconVisibility: controlVisibility,
'no-arrows': noArrows,
valid: validOutline,
valid: [false, isFieldValid][Number(validOutline)],
}"
data-testid="input"
:disabled="disabled"
Expand Down Expand Up @@ -137,7 +137,7 @@ export default {
default: null,
},
/** Provides a green "valid" border to the input */
/** Specifies whether the field should display a green outline on valid state*/
validOutline: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -196,6 +196,10 @@ export default {
return '';
},
isFieldValid() {
return !this.$props.invalid && this.$props.value;
},
},
methods: {
Expand Down

0 comments on commit bbad56e

Please sign in to comment.