File tree Expand file tree Collapse file tree 4 files changed +110
-0
lines changed Expand file tree Collapse file tree 4 files changed +110
-0
lines changed Original file line number Diff line number Diff line change
1
+ .list {
2
+ background-color : # ddd ;
3
+ padding : 1rem ;
4
+ }
5
+
6
+ .item {
7
+ list-style : none;
8
+ padding : 2rem ;
9
+ border : # 0005 solid black;
10
+ margin-top : -1px ;
11
+ margin-bottom : -1px ;
12
+ background-color : # 7cf ;
13
+ }
14
+
15
+ .item : first-child {
16
+ border-radius : 0.5rem 0.5rem 0 0 ;
17
+ }
18
+
19
+ .item : last-child {
20
+ border-radius : 0 0 0.5rem 0.5rem ;
21
+ }
Original file line number Diff line number Diff line change
1
+ // also exported from '@storybook/react' if you can deal with breaking changes in 6.1
2
+ import { Meta } from "@storybook/react" ;
3
+ import { ReactSortable , ReactSortableProps } from "../../src" ;
4
+ import { ULLITemplate , ULLITemplateProps } from "../templates/ul-li" ;
5
+
6
+ export default {
7
+ title : "Example/MultiDrag" ,
8
+ component : ReactSortable ,
9
+ args : {
10
+ animation : 200 ,
11
+ multiDrag : true ,
12
+ list : [
13
+ {
14
+ id : "1" ,
15
+ text : "Hello, World!" ,
16
+ } ,
17
+ {
18
+ id : "2" ,
19
+ text : "Hello, Earth!" ,
20
+ } ,
21
+ {
22
+ id : "3" ,
23
+ text : "Goodbye, World!" ,
24
+ } ,
25
+ ] ,
26
+ } ,
27
+ } as Meta < ReactSortableProps < ULLITemplateProps > > ;
28
+
29
+ export const Primary = ULLITemplate . bind ( { } ) ;
30
+ Primary . args = {
31
+ tag : "ul" ,
32
+ } ;
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ // also exported from '@storybook/react' if you can deal with breaking changes in 6.1
3
+ import { Story } from "@storybook/react" ;
4
+ import { ReactSortable , ReactSortableProps } from "../../dist" ;
5
+ import "../classic.css" ;
6
+
7
+ export interface ULLITemplateProps {
8
+ id : string ;
9
+ text : string ;
10
+ }
11
+
12
+ export const ULLITemplate : Story < ReactSortableProps < ULLITemplateProps > > = (
13
+ args
14
+ ) => {
15
+ const [ list , setList ] = React . useState < ULLITemplateProps [ ] > ( args . list ) ;
16
+
17
+ return (
18
+ < ReactSortable className = "list" { ...args } list = { list } setList = { setList } >
19
+ { list . map ( ( { id, text } ) => (
20
+ < li className = "item" key = { id } >
21
+ { text }
22
+ </ li >
23
+ ) ) }
24
+ </ ReactSortable >
25
+ ) ;
26
+ } ;
Original file line number Diff line number Diff line change
1
+ // also exported from '@storybook/react' if you can deal with breaking changes in 6.1
2
+ import { Meta } from "@storybook/react" ;
3
+ import { ReactSortableProps , ReactSortable } from "../../src" ;
4
+ import { ULLITemplate , ULLITemplateProps } from "../templates/ul-li" ;
5
+
6
+ export default {
7
+ title : "Example/Simple List" ,
8
+ component : ReactSortable ,
9
+ args : {
10
+ animation : 200 ,
11
+ list : [
12
+ {
13
+ id : "1" ,
14
+ text : "Hello, World!" ,
15
+ } ,
16
+ {
17
+ id : "2" ,
18
+ text : "Hello, Earth!" ,
19
+ } ,
20
+ {
21
+ id : "3" ,
22
+ text : "Goodbye, World!" ,
23
+ } ,
24
+ ] ,
25
+ } ,
26
+ } as Meta < ReactSortableProps < ULLITemplateProps > > ;
27
+
28
+ export const Primary = ULLITemplate . bind ( { } ) ;
29
+ Primary . args = {
30
+ tag : "ul" ,
31
+ } ;
You can’t perform that action at this time.
0 commit comments