summaryrefslogblamecommitdiffstatshomepage
path: root/frontend/src/lib/components/Dropdown.svelte
blob: 9e935e40e96af7be6a23cdd360ee0703d5d06140 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                                     
<script lang="ts">
	import { clickOutside } from '$lib/Actions';
	import { fadeFast } from '$lib/Transitions';
	import { fade } from 'svelte/transition';

	export let visible: boolean;
	export let parent: HTMLElement;
</script>

{#if visible}
	<div
		class="absolute z-[1] mt-1 w-max rounded bg-slate-700 p-1 shadow-sm shadow-slate-900"
		transition:fade={fadeFast}
		use:clickOutside={{ handler: () => (visible = false), ignore: parent }}
	>
		<slot />
	</div>
{/if}