Skip to content

Commit d3d5622

Browse files
author
Gadzhi Kharkharov
committed
nesting examples
1 parent 902da88 commit d3d5622

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

examples/03 Nesting/Drag Sources/Container.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import HTML5Backend from 'react-dnd/modules/backends/HTML5';
99
export default class Container {
1010
render() {
1111
return (
12-
<div style={{ height: 320 }}>
12+
<div style={{ overflow: 'hidden', clear: 'both', margin: '-.5rem' }}>
1313
<div style={{ float: 'left' }}>
1414
<SourceBox color={Colors.BLUE}>
1515
<SourceBox color={Colors.YELLOW}>
@@ -22,7 +22,7 @@ export default class Container {
2222
</SourceBox>
2323
</div>
2424

25-
<div style={{ float: 'left', marginLeft: 100, marginTop: 50 }}>
25+
<div style={{ float: 'left', marginLeft: '5rem', marginTop: '.5rem' }}>
2626
<TargetBox />
2727
</div>
2828
</div>

examples/03 Nesting/Drag Sources/SourceBox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DragSource } from 'react-dnd';
55
const style = {
66
border: '1px dashed gray',
77
padding: '0.5rem',
8-
margin: '0.5rem'
8+
margin: '0.5rem',
99
};
1010

1111
const ColorSource = {
@@ -55,7 +55,7 @@ class SourceBox extends Component {
5555
<input type='checkbox'
5656
checked={forbidDrag}
5757
onChange={onToggleForbidDrag}>
58-
Forbid drag
58+
<small>Forbid drag</small>
5959
</input>
6060

6161
{children}

examples/03 Nesting/Drag Sources/TargetBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DropTarget } from 'react-dnd';
33
import Colors from './Colors';
44

55
const style = {
6-
border: '1px dashed gray',
6+
border: '1px solid gray',
77
height: '15rem',
88
width: '15rem',
99
padding: '2rem',

examples/03 Nesting/Drop Targets/Box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DragSource } from 'react-dnd';
55
const style = {
66
display: 'inline-block',
77
border: '1px dashed gray',
8-
padding: '0.5rem',
8+
padding: '0.5rem 1rem',
99
backgroundColor: 'white',
1010
cursor: 'move'
1111
};

examples/03 Nesting/Drop Targets/Container.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class Container {
99
render() {
1010
return (
1111
<div>
12-
<div style={{minHeight: '14rem', overflow: 'auto'}}>
12+
<div style={{ overflow: 'hidden', clear: 'both', margin: '-1rem' }}>
1313
<Dustbin greedy>
1414
<Dustbin greedy>
1515
<Dustbin greedy />
@@ -23,7 +23,7 @@ export default class Container {
2323
</Dustbin>
2424
</div>
2525

26-
<div style={{ minHeight: '2rem' }}>
26+
<div style={{ overflow: 'hidden', clear: 'both', marginTop: '1.5rem' }}>
2727
<Box />
2828
</div>
2929
</div>

examples/03 Nesting/Drop Targets/Dustbin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { DropTarget } from 'react-dnd';
44

55
function getStyle(backgroundColor) {
66
return {
7-
border: '2px dashed #ddd',
7+
border: '1px solid rgba(0,0,0,0.2)',
88
minHeight: '8rem',
99
minWidth: '8rem',
1010
color: 'white',
1111
backgroundColor: backgroundColor,
1212
padding: '2rem',
13-
marginRight: '0.5rem',
14-
marginBottom: '0.5rem',
15-
marginTop: '0.5rem',
13+
paddingTop: '1rem',
14+
margin: '1rem',
1615
textAlign: 'center',
17-
float: 'left'
16+
float: 'left',
17+
fontSize: '1rem'
1818
};
1919
}
2020

@@ -70,9 +70,9 @@ export default class Dustbin extends Component {
7070
return connectDropTarget(
7171
<div style={getStyle(backgroundColor)}>
7272
{text}
73-
73+
<br/>
7474
{hasDropped &&
75-
<span> &middot; dropped {hasDroppedOnChild && ' on child'}</span>
75+
<span>dropped {hasDroppedOnChild && ' on child'}</span>
7676
}
7777

7878
<div>

0 commit comments

Comments
 (0)