ChatMenu.svelte 1.52 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
2
<script lang="ts">
	import { DropdownMenu } from 'bits-ui';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
	import { flyAndScale } from '$lib/utils/transitions';
Timothy J. Baek's avatar
Timothy J. Baek committed
4
5
6
7

	import Dropdown from '$lib/components/common/Dropdown.svelte';
	import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
	import Pencil from '$lib/components/icons/Pencil.svelte';
8
	import Tooltip from '$lib/components/common/Tooltip.svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
11

	export let renameHandler: Function;
	export let deleteHandler: Function;
Timothy J. Baek's avatar
Timothy J. Baek committed
12
13

	export let onClose: Function;
Timothy J. Baek's avatar
Timothy J. Baek committed
14
15
</script>

Timothy J. Baek's avatar
Timothy J. Baek committed
16
17
18
19
20
21
22
<Dropdown
	on:change={(e) => {
		if (e.detail === false) {
			onClose();
		}
	}}
>
23
24
25
	<Tooltip content="More">
		<slot />
	</Tooltip>
Timothy J. Baek's avatar
Timothy J. Baek committed
26
27
28

	<div slot="content">
		<DropdownMenu.Content
Timothy J. Baek's avatar
Timothy J. Baek committed
29
			class="w-full max-w-[150px] rounded-lg px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-900 dark:text-white shadow"
Timothy J. Baek's avatar
Timothy J. Baek committed
30
			sideOffset={-2}
Timothy J. Baek's avatar
Timothy J. Baek committed
31
32
			side="bottom"
			align="start"
Timothy J. Baek's avatar
Timothy J. Baek committed
33
			transition={flyAndScale}
Timothy J. Baek's avatar
Timothy J. Baek committed
34
35
		>
			<DropdownMenu.Item
Timothy J. Baek's avatar
Timothy J. Baek committed
36
				class="flex gap-2 items-center px-3 py-2 text-sm  font-medium cursor-pointer dark:hover:bg-gray-850 rounded-md"
Timothy J. Baek's avatar
Timothy J. Baek committed
37
38
39
40
41
42
43
44
45
				on:click={() => {
					renameHandler();
				}}
			>
				<Pencil strokeWidth="2" />
				<div class="flex items-center">Rename</div>
			</DropdownMenu.Item>

			<DropdownMenu.Item
Timothy J. Baek's avatar
Timothy J. Baek committed
46
				class="flex  gap-2  items-center px-3 py-2 text-sm  font-medium cursor-pointer dark:hover:bg-gray-850 rounded-md"
Timothy J. Baek's avatar
Timothy J. Baek committed
47
48
49
50
51
52
53
54
55
56
				on:click={() => {
					deleteHandler();
				}}
			>
				<GarbageBin strokeWidth="2" />
				<div class="flex items-center">Delete</div>
			</DropdownMenu.Item>
		</DropdownMenu.Content>
	</div>
</Dropdown>