File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 23
23
type =" warning"
24
24
border =" start"
25
25
class =" mb-5"
26
+ :class =" { 'shaking': errorshake }"
26
27
>Wrong username or password!
27
28
</v-alert >
28
29
<form v-on:submit =" login" >
@@ -93,6 +94,7 @@ export default defineComponent({
93
94
name: " Login" ,
94
95
data : () => ({
95
96
error: false ,
97
+ errorshake: false ,
96
98
authMethods : {
97
99
" local" : false ,
98
100
" github" : false ,
@@ -135,6 +137,10 @@ export default defineComponent({
135
137
})
136
138
.catch ((errors ) => {
137
139
this .error = true ;
140
+ this .errorshake = true ;
141
+ setTimeout (() => {
142
+ this .errorshake = false ;
143
+ }, 300 );
138
144
console .log (" Cannot log in" + errors )
139
145
})
140
146
}
@@ -158,4 +164,18 @@ export default defineComponent({
158
164
}
159
165
}
160
166
});
161
- </script >
167
+ </script >
168
+
169
+ <style scoped>
170
+ /* https://unused-css.com/blog/css-shake-animation/ */
171
+ @keyframes horizontal-shaking {
172
+ 0% { transform : translateX (0 ) }
173
+ 25% { transform : translateX (5px ) }
174
+ 50% { transform : translateX (-5px ) }
175
+ 75% { transform : translateX (5px ) }
176
+ 100% { transform : translateX (0 ) }
177
+ }
178
+ .shaking {
179
+ animation : horizontal-shaking 0.3s ease-in-out ;
180
+ }
181
+ </style >
You can’t perform that action at this time.
0 commit comments