diff --git a/README.md b/README.md index cccfa41..cf05802 100644 --- a/README.md +++ b/README.md @@ -339,17 +339,24 @@ interface DragDropState { high: 'bg-red-50 text-red-700' }[priority]; }; + + const dragStyles = { + low: 'bg-gradient-to-r from-sky-400/30 via-blue-400/20 to-indigo-400/30 backdrop-blur-lg', + medium: + 'bg-gradient-to-r from-amber-400/30 via-orange-400/20 to-yellow-400/30 backdrop-blur-lg', + high: 'bg-gradient-to-r from-rose-400/30 via-red-400/20 to-pink-400/30 backdrop-blur-lg' + }; -
+
-

Sortable List

-

Drag and drop items to reorder them in the list.

+

Custom classes

+

You can add custom classes to the draggable and droppable elements.

-
-
+
+
{#each items as item, index (item.id)}
{ container: index.toString(), callbacks: { onDrop: handleDrop }, attributes: { - draggingClass: 'border border-blue-500', - dragOverClass: 'border border-red-500' + draggingClass: 'scale-105 rotate-2 !shadow-2xl !ring-2 ring-blue-500/50 z-50', + dragOverClass: 'scale-98 -rotate-1 !shadow-inner !ring-2 ring-emerald-500/50' } }} - animate:flip={{ duration: 200 }} - in:fade={{ duration: 150 }} - out:fade={{ duration: 150 }} - class="svelte-dnd-touch-feedback cursor-move rounded-lg bg-white p-3 shadow-sm - ring-gray-200 transition-all duration-200 hover:shadow-md hover:ring-2 hover:ring-blue-200" + animate:flip={{ duration: 400, easing: 'cubic-bezier(0.4, 0, 0.2, 1)' }} + in:fade={{ duration: 300 }} + out:fade={{ duration: 200 }} + class="group relative cursor-move rounded-lg p-4 + shadow-md ring-1 ring-white/60 + backdrop-blur-md transition-all duration-500 + ease-out hover:-rotate-1 hover:scale-[1.02] + hover:shadow-xl active:shadow-inner + {dragStyles[item.priority]}" > -
-

- {item.title} -

- - {item.priority} - +
+ +
+ + +
+
+

{item.title}

+ + {item.priority} + +
+

{item.description}

+
-

- {item.description} -

{/each}
@@ -391,12 +408,31 @@ interface DragDropState { ``` diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index dec96d5..7d955f6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,7 +10,8 @@ { path: '/horizontal-scroll', title: 'Horizontal Scroll' }, { path: '/grid-sort', title: 'Grid Sort' }, { path: '/nested', title: 'Nested Containers' }, - { path: '/multiple', title: 'Multiple' } + { path: '/multiple', title: 'Multiple' }, + { path: '/custom-classes', title: 'Custom Classes' } ]; const cn = (...classes: string[]) => classes.filter(Boolean).join(' '); diff --git a/src/routes/custom-classes/+page.svelte b/src/routes/custom-classes/+page.svelte index 7521f18..ee25480 100644 --- a/src/routes/custom-classes/+page.svelte +++ b/src/routes/custom-classes/+page.svelte @@ -49,17 +49,24 @@ high: 'bg-red-50 text-red-700' }[priority]; }; + + const dragStyles = { + low: 'bg-gradient-to-r from-sky-400/30 via-blue-400/20 to-indigo-400/30 backdrop-blur-lg', + medium: + 'bg-gradient-to-r from-amber-400/30 via-orange-400/20 to-yellow-400/30 backdrop-blur-lg', + high: 'bg-gradient-to-r from-rose-400/30 via-red-400/20 to-pink-400/30 backdrop-blur-lg' + }; -
+
-

Sortable List

-

Drag and drop items to reorder them in the list.

+

Custom classes

+

You can add custom classes to the draggable and droppable elements.

-
-
+
+
{#each items as item, index (item.id)}
-
-

- {item.title} -

- - {item.priority} - +
+ +
+ + +
+
+

{item.title}

+ + {item.priority} + +
+

{item.description}

+
-

- {item.description} -

{/each}
@@ -101,10 +118,29 @@ diff --git a/src/routes/grid-sort/+page.svelte b/src/routes/grid-sort/+page.svelte index a0d6735..e70e830 100644 --- a/src/routes/grid-sort/+page.svelte +++ b/src/routes/grid-sort/+page.svelte @@ -26,9 +26,7 @@ } -
+

SortGable Grid

@@ -40,7 +38,7 @@
{card.icon} @@ -56,8 +54,7 @@
Position {index + 1}