Skip to content

Commit

Permalink
chore: 🤖 upgrade @dnd-kit/core ^6
Browse files Browse the repository at this point in the history
close#6
  • Loading branch information
ThaddeusJiang committed Oct 9, 2024
1 parent a35019c commit 00cf41d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
30 changes: 16 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@
"tslib": "^2.3.1",
"typescript": "^4.6.3"
},
"dependencies": {
"@dnd-kit/core": "^5.0.3",
"@dnd-kit/sortable": "^6.0.1"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
Expand All @@ -98,5 +94,9 @@
"Sortable List",
"Drag and Drop",
"@dnd-kit"
]
],
"dependencies": {
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0"
}
}
19 changes: 17 additions & 2 deletions stories/SortableList.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useState } from '@storybook/addons';
import { Meta } from '@storybook/react';
import React from 'react';

import {
Expand All @@ -12,7 +11,7 @@ import {
export default {
component: SortableList,
title: 'components/SortableList',
} as Meta;
};

const DragHandler = (props) => (
<div
Expand Down Expand Up @@ -81,6 +80,22 @@ export const ChildrenExample: React.VFC = () => {
);
};

const data = Array.from({ length: 30 }, (_, index) => ({
id: `${index}`,
name: `Item ${index}`,
}));

export const DraggingScrollingExample: React.VFC = () => {
const [items, setItems] = useState<SortableItemProps[]>(data);
return (
<SortableList
items={items}
setItems={setItems}
itemRender={({ item }: ItemRenderProps) => <Item name={item.name} />}
/>
);
};

export const DragHandlerExample: React.VFC = () => {
const [items, setItems] = useState<SortableItemProps[]>([
{ id: '1', name: 'Item 1' },
Expand Down

0 comments on commit 00cf41d

Please sign in to comment.