carousel: switch to `if/else` (#32395)

There are only two conditions, so `if/else` is shorter and has the same effect.
This commit is contained in:
XhmikosR 2020-12-10 00:38:24 +02:00 committed by GitHub
parent 8fed098ef9
commit 6f9c38f65e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -340,16 +340,12 @@ class Carousel extends BaseComponent {
return return
} }
switch (event.key) { if (event.key === ARROW_LEFT_KEY) {
case ARROW_LEFT_KEY: event.preventDefault()
event.preventDefault() this.prev()
this.prev() } else if (event.key === ARROW_RIGHT_KEY) {
break event.preventDefault()
case ARROW_RIGHT_KEY: this.next()
event.preventDefault()
this.next()
break
default:
} }
} }