feat(web): better context menu position (#4271)

* feat(web): better context menu position

* fix: album context menu

* fix: add middle variant

* fix: rest of context menus

* fix: linting error
This commit is contained in:
Jason Rasmussen
2023-09-29 13:41:58 -04:00
committed by GitHub
parent 3e73cfb71a
commit 68d6d89a3b
8 changed files with 40 additions and 29 deletions

View File

@@ -10,6 +10,7 @@
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import ContextMenu from '$lib/components/shared-components/context-menu/context-menu.svelte';
import type Icon from 'svelte-material-icons/AbTesting.svelte';
import { getContextMenuPosition } from '$lib/utils/context-menu';
export let icon: typeof Icon;
export let title: string;
@@ -17,9 +18,8 @@
let showContextMenu = false;
let contextMenuPosition = { x: 0, y: 0 };
const handleShowMenu = ({ x }: MouseEvent) => {
const navigationBarHeight = 75;
contextMenuPosition = { x: x, y: navigationBarHeight };
const handleShowMenu = (event: MouseEvent) => {
contextMenuPosition = getContextMenuPosition(event, 'top-left');
showContextMenu = !showContextMenu;
};