Skip to content

Commit 6605e82

Browse files
committed
style: update drag-and-drop styles for improved visual feedback and consistency
1 parent 5b3990c commit 6605e82

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

src/lib/styles/dnd.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@
3232

3333
/* Drop preview/placeholder */
3434
.svelte-dnd-placeholder {
35-
opacity: 0.3;
3635
border: 2px dashed #9e9e9e;
3736
}
3837

3938
/* Visual feedback for touch interactions */
4039
.svelte-dnd-touch-feedback {
41-
opacity: 0.7;
4240
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
4341
border-color: #2196f3;
4442
}

src/routes/+page.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
{#each tasksByStatus as { status, items }}
9292
<div class="w-80 flex-none">
9393
<div
94-
class="rounded-xl bg-white p-4 shadow-sm ring-1 ring-gray-200"
94+
class="rounded-xl bg-gray-100 p-4 shadow-sm ring-1 ring-gray-200"
9595
use:droppable={{
9696
// The container is the status of the task. e.g. 'todo', 'in-progress', 'done'
9797
container: status,
@@ -120,8 +120,8 @@
120120
animate:flip={{ duration: 200 }}
121121
in:fade={{ duration: 150 }}
122122
out:fade={{ duration: 150 }}
123-
class="cursor-move rounded-lg bg-white p-3 shadow-sm ring-1 ring-gray-200
124-
transition-all duration-200 hover:shadow-md hover:ring-2 hover:ring-blue-200 svelte-dnd-touch-feedback"
123+
class="svelte-dnd-touch-feedback cursor-move rounded-lg bg-white p-3 shadow-sm ring-1
124+
ring-gray-200 transition-all duration-200 hover:shadow-md hover:ring-2 hover:ring-blue-200"
125125
>
126126
<div class="mb-2 flex items-start justify-between gap-2">
127127
<h3 class="font-medium text-gray-900">

src/routes/horizontal-scroll/+page.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script lang="ts">
22
import { draggable, droppable, type DragDropState } from '$lib/index.js';
3+
import { flip } from 'svelte/animate';
4+
import { fade } from 'svelte/transition';
35
import '$lib/styles/dnd.css';
46
57
interface ImageItem {
@@ -34,14 +36,17 @@
3436
<div
3537
use:droppable={{ container: index.toString(), callbacks: { onDrop: handleDrop } }}
3638
class="relative"
39+
animate:flip={{ duration: 200 }}
3740
>
3841
<div
3942
use:draggable={{
4043
container: index.toString(),
4144
dragData: image
4245
}}
43-
class="group relative h-[300px] w-[200px] cursor-move overflow-hidden rounded-xl
44-
transition-transform hover:scale-105 svelte-dnd-touch-feedback"
46+
in:fade={{ duration: 150 }}
47+
out:fade={{ duration: 150 }}
48+
class="svelte-dnd-touch-feedback group relative h-[300px] w-[200px] cursor-move overflow-hidden
49+
rounded-xl transition-transform hover:scale-105"
4550
>
4651
<img
4752
src={image.url}

src/routes/nested/+page.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { droppable, draggable, type DragDropState } from '$lib/index.js';
33
import { fade } from 'svelte/transition';
4+
import { flip } from 'svelte/animate';
45
import '$lib/styles/dnd.css';
56
67
interface Item {
@@ -122,13 +123,14 @@
122123
container: groupIndex.toString(),
123124
callbacks: { onDrop: handleGroupDrop }
124125
}}
126+
animate:flip={{ duration: 200 }}
125127
>
126128
<div
127129
use:draggable={{
128130
container: groupIndex.toString(),
129131
dragData: group
130132
}}
131-
class="rounded-xl bg-white p-4 shadow-sm ring-1 ring-gray-200 svelte-dnd-touch-feedback"
133+
class="svelte-dnd-touch-feedback rounded-xl bg-white p-4 shadow-sm ring-1 ring-gray-200"
132134
in:fade={{ duration: 150 }}
133135
out:fade={{ duration: 150 }}
134136
>
@@ -159,8 +161,8 @@
159161
container: `${group.id}:${itemIndex}`,
160162
dragData: item
161163
}}
162-
class="cursor-move rounded-lg bg-white p-3 shadow-sm ring-1 ring-gray-200
163-
transition-all duration-200 hover:shadow-md hover:ring-2 hover:ring-blue-200 svelte-dnd-touch-feedback"
164+
class="svelte-dnd-touch-feedback cursor-move rounded-lg bg-white p-3 shadow-sm ring-1
165+
ring-gray-200 transition-all duration-200 hover:shadow-md hover:ring-2 hover:ring-blue-200"
164166
>
165167
<div class="mb-2 flex items-start justify-between gap-2">
166168
<h3 class="font-medium text-gray-900">{item.title}</h3>

src/routes/simple-list/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</div>
5959

6060
<div class="w-80">
61-
<div class="rounded-xl bg-white p-4 shadow-sm ring-1 ring-gray-200">
61+
<div class="rounded-xl bg-gray-100 p-4 shadow-sm ring-1 ring-gray-200">
6262
<div class="space-y-3">
6363
{#each items as item, index (item.id)}
6464
<div

0 commit comments

Comments
 (0)