This repository was archived by the owner on Jan 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +41
-12
lines changed Expand file tree Collapse file tree 1 file changed +41
-12
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState } from "react" ;
2
2
import styled from "styled-components" ;
3
- import { MultiDrag , ReactSortable } from "../../src" ;
3
+ import { MultiDrag , ReactSortable , Sortable } from "../../src" ;
4
4
import { Item , threes } from "../util" ;
5
5
6
+ Sortable . mount ( new MultiDrag ( ) )
7
+
6
8
export function MultiDragExample ( ) {
7
9
const [ list , setList ] = useState ( threes ) ;
10
+ const [ list1 , setList1 ] = useState ( threes ) ;
11
+
8
12
return (
9
- < ReactSortable
10
- multiDrag
11
- plugins = { [ new MultiDrag ( ) ] }
12
- list = { list }
13
- setList = { setList }
14
- animation = { 150 }
15
- >
16
- { list . map ( item => (
17
- < MultiDragItem key = { item . id } > { item . name } </ MultiDragItem >
18
- ) ) }
19
- </ ReactSortable >
13
+ < Column >
14
+ < ReactSortable
15
+ multiDrag
16
+ list = { list }
17
+ setList = { setList }
18
+ animation = { 150 }
19
+ group = "shrek"
20
+ >
21
+ { list . map ( item => (
22
+ < MultiDragItem key = { item . id } > { item . name } </ MultiDragItem >
23
+ ) ) }
24
+ </ ReactSortable >
25
+ < ReactSortable
26
+ multiDrag
27
+ list = { list1 }
28
+ setList = { setList1 }
29
+ animation = { 150 }
30
+ group = "shrek"
31
+ >
32
+ { list1 . map ( item => (
33
+ < MultiDragItem key = { item . id } > { item . name } </ MultiDragItem >
34
+ ) ) }
35
+ </ ReactSortable >
36
+ </ Column >
20
37
) ;
21
38
}
22
39
40
+ const Column = styled . div `
41
+ display: flex;
42
+ width: inherit;
43
+ & > * {
44
+ width: 100%;
45
+ margin-left: 0.3rem;
46
+ :first-child() {
47
+ margin-left: 0rem;
48
+ }
49
+ }
50
+ ` ;
51
+
23
52
const MultiDragItem = styled ( Item ) `
24
53
&.sortable-selected {
25
54
background-color: #0a0a;
You can’t perform that action at this time.
0 commit comments