fix(ui): revert sticky album overlay and stabilize menu positioning
This commit is contained in:
1 parent
64af963608
commit
1e562264ea
2 files changed
+9
-10
No files matched your search
@@ -65,7 +65,6 @@
|
||||
const showFavoriteButton = $derived(showFavorite ?? !!albumId);
|
||||
const favoriteAvailable = $derived(favoriteEnabled ?? !!albumId);
|
||||
const hasOverlay = $derived(!!(showFavoriteButton || onPlay || hasMenu));
|
||||
let menuOpen = $state(false);
|
||||
|
||||
function handleImageError() {
|
||||
imageError = true;
|
||||
@@ -160,7 +159,7 @@
|
||||
|
||||
<!-- Action Overlay -->
|
||||
{#if hasOverlay}
|
||||
<div class="action-overlay" class:menu-open={menuOpen}>
|
||||
<div class="action-overlay">
|
||||
<div class="action-buttons">
|
||||
{#if showFavoriteButton}
|
||||
<button
|
||||
@@ -189,7 +188,6 @@
|
||||
onShareQobuz={onShareQobuz}
|
||||
onShareSonglink={onShareSonglink}
|
||||
onDownload={onDownload}
|
||||
onOpenChange={(open) => (menuOpen = open)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -291,8 +289,7 @@
|
||||
}
|
||||
|
||||
.album-card:hover .action-overlay,
|
||||
.action-overlay:focus-within,
|
||||
.action-overlay.menu-open {
|
||||
.action-overlay:focus-within {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
onShareQobuz?: () => void;
|
||||
onShareSonglink?: () => void;
|
||||
onDownload?: () => void;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -24,8 +23,7 @@
|
||||
onPlayLater,
|
||||
onShareQobuz,
|
||||
onShareSonglink,
|
||||
onDownload,
|
||||
onOpenChange
|
||||
onDownload
|
||||
}: Props = $props();
|
||||
|
||||
let isOpen = $state(false);
|
||||
@@ -46,7 +44,6 @@
|
||||
function closeMenu() {
|
||||
isOpen = false;
|
||||
shareOpen = false;
|
||||
onOpenChange?.(false);
|
||||
}
|
||||
|
||||
function handleClickOutside(event: MouseEvent) {
|
||||
@@ -114,6 +111,12 @@
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (isOpen && menuEl && triggerRef) {
|
||||
setMenuPosition();
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (isOpen) {
|
||||
document.addEventListener('mousedown', handleClickOutside);
|
||||
@@ -148,7 +151,6 @@
|
||||
e.stopPropagation();
|
||||
isOpen = !isOpen;
|
||||
shareOpen = false;
|
||||
onOpenChange?.(isOpen);
|
||||
if (isOpen) setMenuPosition();
|
||||
}}
|
||||
aria-label="Album actions"
|
||||
|
||||
Reference in new issue
Block a user