Skip to content

Commit 73a2ba4

Browse files
committed
fix: Draggable Props should be disabled on card when draggable prop on Board is set to false
dragProvided.draggableProps.style was undefined when drag-n-drop was disabled on the card #60
1 parent 8411ed2 commit 73a2ba4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Card.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ class Card extends Component {
3838
})
3939

4040
render() {
41-
const {id, index, cardStyle, editable, customCardLayout, ...otherProps} = this.props
41+
const {id, index, cardStyle, draggable, editable, customCardLayout, ...otherProps} = this.props
4242
const style = customCardLayout ? {...cardStyle, padding: 0} : cardStyle
43+
const isDragDisabled = !draggable
4344
return (
44-
<Draggable key={id} draggableId={id} index={index}>
45+
<Draggable key={id} draggableId={id} index={index} isDragDisabled={isDragDisabled}>
4546
{(dragProvided, dragSnapshot) => {
46-
const dragStyle = this.getItemStyle(dragSnapshot.isDragging, dragProvided.draggableProps.style)
47+
const draggablePropsStyle = dragProvided.draggableProps && dragProvided.draggableProps.style
48+
const dragStyle = this.getItemStyle(dragSnapshot.isDragging, draggablePropsStyle)
4749
return (
4850
<div>
4951
<MovableCardWrapper

stories/BoardStyling.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ const data = require('./data.json')
1111
storiesOf('Advanced Features', module).add(
1212
'Board Styling',
1313
withInfo('Change the background and other css styles for the board container')(() =>
14-
<Board data={data} style={{}} className='boardContainer' />
14+
<Board data={data} style={{padding: '30px 20px'}} className='boardContainer' />
1515
)
1616
)

0 commit comments

Comments
 (0)