Skip to content

Commit

Permalink
fix: Draggable Props should be disabled on card when draggable prop o…
Browse files Browse the repository at this point in the history
…n Board is set to false

dragProvided.draggableProps.style was undefined when drag-n-drop was disabled on the card

#60
  • Loading branch information
rcdexta committed Jan 23, 2018
1 parent 8411ed2 commit 73a2ba4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ class Card extends Component {
})

render() {
const {id, index, cardStyle, editable, customCardLayout, ...otherProps} = this.props
const {id, index, cardStyle, draggable, editable, customCardLayout, ...otherProps} = this.props
const style = customCardLayout ? {...cardStyle, padding: 0} : cardStyle
const isDragDisabled = !draggable
return (
<Draggable key={id} draggableId={id} index={index}>
<Draggable key={id} draggableId={id} index={index} isDragDisabled={isDragDisabled}>
{(dragProvided, dragSnapshot) => {
const dragStyle = this.getItemStyle(dragSnapshot.isDragging, dragProvided.draggableProps.style)
const draggablePropsStyle = dragProvided.draggableProps && dragProvided.draggableProps.style
const dragStyle = this.getItemStyle(dragSnapshot.isDragging, draggablePropsStyle)
return (
<div>
<MovableCardWrapper
Expand Down
2 changes: 1 addition & 1 deletion stories/BoardStyling.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ const data = require('./data.json')
storiesOf('Advanced Features', module).add(
'Board Styling',
withInfo('Change the background and other css styles for the board container')(() =>
<Board data={data} style={{}} className='boardContainer' />
<Board data={data} style={{padding: '30px 20px'}} className='boardContainer' />
)
)

0 comments on commit 73a2ba4

Please sign in to comment.