Files
gpx.studio/website/src/lib/components/toolbar/ToolbarItemMenu.svelte

31 lines
694 B
Svelte
Raw Normal View History

2024-04-22 19:36:31 +02:00
<script lang="ts">
import { type Tool, currentTool } from '$lib/stores';
2024-04-22 19:36:31 +02:00
import { flyAndScale } from '$lib/utils';
import * as Card from '$lib/components/ui/card';
export let tool: Tool;
export let active = false;
$: active = $currentTool === tool;
2024-04-22 19:36:31 +02:00
</script>
{#if active}
<div in:flyAndScale={{ x: -2, y: 0, duration: 100 }} class="translate-x-1 h-full">
<div class="rounded-md shadow-md pointer-events-auto">
<Card.Root class="border-none">
2024-05-07 17:19:53 +02:00
<Card.Content class="p-3 flex flex-col gap-3">
<slot />
</Card.Content>
</Card.Root>
</div>
2024-04-22 19:36:31 +02:00
</div>
{/if}
2024-05-07 17:19:53 +02:00
<svelte:window
on:keydown={(e) => {
if (active && e.key === 'Escape') {
currentTool.set(null);
}
}}
/>