Skip to content

Commit

Permalink
fix: disable button when form is disabled (#26)
Browse files Browse the repository at this point in the history
* fix: disable button when form is disabled

* Update browser tests
  • Loading branch information
burden authored Mar 24, 2021
1 parent 919e3ce commit 58e4a2c
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/components/sys-form.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,41 @@ form, we catch it, and display it.
}}
</Story>
</Preview>

### Disabled

This is how a disabled form would look.

<Preview>
<Story height="400px" name="Disabled">
{{
data: () => ({
email: '',
password: ''
}),
methods: {
submit () {
confirm('submit')
}
},
template: `
<sys-form :submit-function="submit" disabled>
<sys-form-input
v-model="email"
id="email"
label="Email Address"
name="email"
validation="email|required"
/>
<sys-form-input
v-model="password"
id="password"
label="Password"
name="password"
validation="required|min:6"
/>
</sys-form>
`
}}
</Story>
</Preview>
2 changes: 1 addition & 1 deletion src/components/sys-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
>
<sys-form-button
:color="submitColor"
:disabled="!binds.valid || submitting"
:disabled="!binds.valid || submitting || disabled"
>
{{ submitText }}
</sys-form-button>
Expand Down
Binary file modified test/screenshots/tests/sys-form-button/colors-normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshots/tests/sys-form-button/colors-primary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshots/tests/sys-form-button/colors-secondary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshots/tests/sys-form/reactive-disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshots/tests/sys-form/reactive-enabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshots/tests/sys-form/thumbnails/reactive-enabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 58e4a2c

Please sign in to comment.