feat: add toggle watchlist on anime cards and improve dropdown
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class UIDropdown extends HTMLElement {
|
||||
isOpen: boolean = false
|
||||
contentEl: HTMLElement | null = null
|
||||
isClosing: boolean = false
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
@@ -28,6 +29,7 @@ class UIDropdown extends HTMLElement {
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if (this.isClosing) return
|
||||
this.isOpen = !this.isOpen
|
||||
if (this.contentEl) {
|
||||
if (this.isOpen) {
|
||||
@@ -39,10 +41,15 @@ class UIDropdown extends HTMLElement {
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.isClosing) return
|
||||
this.isClosing = true
|
||||
this.isOpen = false
|
||||
if (this.contentEl) {
|
||||
this.contentEl.classList.add('hidden')
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.isClosing = false
|
||||
}, 100)
|
||||
}
|
||||
|
||||
handleClickOutside(event: MouseEvent) {
|
||||
|
||||
Reference in New Issue
Block a user