Allow users to reorder favorite friend groups in the sidebar

This commit is contained in:
pa
2026-02-24 21:34:43 +09:00
committed by Natsumi
parent 304413c1e3
commit 60fc08b472
8 changed files with 344 additions and 5 deletions

View File

@@ -0,0 +1,29 @@
<script setup>
import { computed, ref } from 'vue';
import { GripVertical } from 'lucide-vue-next';
import { useSortable } from '@dnd-kit/vue/sortable';
const props = defineProps({
id: { type: String, required: true },
index: { type: Number, required: true },
label: { type: String, required: true }
});
const element = ref(null);
const { isDragSource } = useSortable({
id: computed(() => props.id),
index: computed(() => props.index),
element
});
</script>
<template>
<div
ref="element"
class="flex items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm select-none cursor-grab active:cursor-grabbing"
:class="{ 'opacity-50': isDragSource }">
<GripVertical class="size-4 shrink-0 text-muted-foreground" />
<span class="truncate">{{ label }}</span>
</div>
</template>