refactor(web): asset select actions (#2444)

* refactor(web): asset select actions

* remaining pages/components + data flow changes

* fix check
This commit is contained in:
Michel Heusschen 2023-05-16 16:13:20 +02:00 committed by GitHub
parent 3ec74444b0
commit ab86d0a18d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 646 additions and 919 deletions

View file

@ -0,0 +1,35 @@
<script lang="ts" context="module">
import { createContext } from '$lib/utils/context';
const { get: getMenuContext, set: setContext } = createContext<() => void>();
export { getMenuContext };
</script>
<script lang="ts">
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';
export let icon: typeof Icon;
export let title: string;
let showContextMenu = false;
let contextMenuPosition = { x: 0, y: 0 };
const handleShowMenu = ({ x, y }: MouseEvent) => {
contextMenuPosition = { x, y };
showContextMenu = !showContextMenu;
};
setContext(() => (showContextMenu = false));
</script>
<CircleIconButton {title} logo={icon} on:click={handleShowMenu} />
{#if showContextMenu}
<ContextMenu {...contextMenuPosition} on:clickoutside={() => (showContextMenu = false)}>
<div class="flex flex-col rounded-lg">
<slot />
</div>
</ContextMenu>
{/if}