2024-04-09 18:46:01 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { Button } from '$lib/components/ui/button';
|
|
|
|
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
|
2024-04-28 18:59:31 +02:00
|
|
|
import { currentTool, type Tool } from '$lib/stores';
|
|
|
|
|
|
|
|
export let tool: Tool;
|
|
|
|
|
|
|
|
function toggleTool() {
|
|
|
|
currentTool.update((current) => (current === tool ? null : tool));
|
|
|
|
}
|
2024-04-09 18:46:01 +02:00
|
|
|
</script>
|
|
|
|
|
2024-04-18 15:30:19 +02:00
|
|
|
<Tooltip.Root openDelay={300}>
|
2024-04-09 18:46:01 +02:00
|
|
|
<Tooltip.Trigger asChild let:builder>
|
2024-04-28 18:59:31 +02:00
|
|
|
<Button
|
|
|
|
builders={[builder]}
|
|
|
|
variant="ghost"
|
2024-06-10 12:06:32 +02:00
|
|
|
class="h-[26px] px-1 py-1.5 {$currentTool === tool ? 'bg-accent' : ''}"
|
2024-04-28 18:59:31 +02:00
|
|
|
on:click={toggleTool}
|
|
|
|
>
|
2024-04-09 18:46:01 +02:00
|
|
|
<slot name="icon" />
|
|
|
|
</Button>
|
|
|
|
</Tooltip.Trigger>
|
|
|
|
<Tooltip.Content side="right">
|
|
|
|
<slot name="tooltip" />
|
|
|
|
</Tooltip.Content>
|
|
|
|
</Tooltip.Root>
|