react-easy-sort
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "react-easy-sort", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A React component to sort items in lists or grids", | ||
@@ -5,0 +5,0 @@ "homepage": "https://ricardo-ch.github.io/react-easy-sort/", |
@@ -5,2 +5,12 @@ # react-easy-sort | ||
 | ||
The goal of this component is to allow sorting elements with drag and drop. | ||
It is mobile friendly by default. It doesn't block scrolling the page when swiping inside it: | ||
the user needs to press an item during at least 200ms to start the drag gesture. | ||
On non-touch device, the drag gesture only starts after moving an element by at least one pixel. | ||
This is done to avoid blocking clicks on clickable elements inside an item. | ||
## Features | ||
@@ -13,2 +23,11 @@ | ||
## Demo | ||
Check out the examples: | ||
- [Example with grid layout](https://codesandbox.io/s/react-easy-sort-grid-demo-87ev9) | ||
- [Example with vertical list layout](https://codesandbox.io/s/react-easy-sort-vertical-list-demo-njg4i) | ||
- [Example with horizontal list layout](https://codesandbox.io/s/react-easy-sort-horizontal-list-demo-69b3k) | ||
- [Interactive avatars demo](https://codesandbox.io/s/react-easy-sort-images-demo-486qk) | ||
## Installation | ||
@@ -51,2 +70,15 @@ | ||
## Props | ||
### SortableList | ||
| Name | Description | Type | Default | | ||
| ------------------------ | :----------------------------------------------: | :--------------------------------------------: | ------: | | ||
| **onSortEnd\*** | Called when the user finishes a sorting gesture. | `(oldIndex: number, newIndex: number) => void` | - | | ||
| **draggedItemClassName** | Class applied to the item being dragged | `string` | - | | ||
### SortableItem | ||
This component doesn't take any other props than its child. This child should be a single React element that can receives a ref. If you pass a component as a child, it needs to be wrapped with `React.forwardRef()`. | ||
## Development | ||
@@ -53,0 +85,0 @@ |
206574
93