ChatMenu.svelte 1.37 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
2
3
4
5
6
<script lang="ts">
	import { DropdownMenu } from 'bits-ui';

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

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

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

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

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

			<DropdownMenu.Item
				class="flex  gap-2  items-center px-3 py-2 text-sm  font-medium cursor-pointer"
				on:click={() => {
					deleteHandler();
				}}
			>
				<GarbageBin strokeWidth="2" />
				<div class="flex items-center">Delete</div>
			</DropdownMenu.Item>
		</DropdownMenu.Content>
	</div>
</Dropdown>