feat: add toggle watchlist on anime cards and improve dropdown

This commit is contained in:
2026-05-02 15:28:37 +02:00
committed by Mikkel Elvers
parent 94e60e0d8b
commit cc9ca1ba9e
14 changed files with 396 additions and 76 deletions

View File

@@ -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) {