Skip to content

Commit

Permalink
fix: Allow lanes and cards to be dropped in their respective containe…
Browse files Browse the repository at this point in the history
…r groups

#30
  • Loading branch information
rcdexta committed May 6, 2018
1 parent 631c248 commit e9c52bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style type="text/css">
body {
font: 14px/18px 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
</style>
8 changes: 6 additions & 2 deletions src/components/Lane.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ class Lane extends Component {
handleDragStart && handleDragStart(payload.id, payload.laneId)
}

shouldAcceptDrop = (sourceContainerOptions) => {
return this.props.droppable && sourceContainerOptions.groupName === 'TrelloLane'
}

onDragEnd = (laneId, result) => {
const {handleDragEnd} = this.props
const {addedIndex, payload} = result
Expand All @@ -150,7 +154,6 @@ class Lane extends Component {
tagStyle,
cardStyle,
draggable,
droppable,
cards,
id
} = this.props
Expand Down Expand Up @@ -181,12 +184,13 @@ class Lane extends Component {
return (
<ScrollableLane innerRef={this.laneDidMount} isDraggingOver={isDraggingOver}>
<Container
orientation="vertical"
groupName="TrelloLane"
onDragStart={this.onDragStart}
onDrop={e => this.onDragEnd(id, e)}
onDragEnter={() => this.setState({isDraggingOver: true})}
onDragLeave={() => this.setState({isDraggingOver: false})}
shouldAcceptDrop={() => droppable}
shouldAcceptDrop={this.shouldAcceptDrop}
getChildPayload={index => this.props.getCardDetails(id, index)}>
{cardList}
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const BoardDiv = styled.div`
background-color: #23719f;
overflow-y: hidden;
padding: 5px;
font: 14px/18px 'Helvetica Neue', Arial, Helvetica, sans-serif;
color: #393939;
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -120,6 +119,7 @@ export const CardRightContent = styled(RightContent)`
export const Detail = styled.div`
font-size: 12px;
color: #4d4d4d;
white-space: normal;
`

export const Footer = styled.div`
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/base.json')
storiesOf('Advanced Features', module).add(
'Board Styling',
withInfo('Change the background and other css styles for the board container')(() =>
<Board data={data} style={{padding: '30px 20px'}} className='boardContainer' />
<Board data={data} style={{padding: '30px 20px', fontFamily: 'Verdana'}} className='boardContainer' />
)
)
5 changes: 3 additions & 2 deletions stories/data/drag-drop.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
]
},
{
"id": "BLOCKED",
"title": "Blocked (Droppable)",
"id": "COMPLETED",
"title": "Completed (Droppable)",
"label": "0/0",
"style": {"width": 280},
"cards": []
}
]
Expand Down

0 comments on commit e9c52bf

Please sign in to comment.