Skip to content

Commit bff9ed8

Browse files
authored
Merge pull request #313 from garvitdelhi/add-drop-classes
Add ability to add drop classes along with drag class
2 parents a797c4d + 852212f commit bff9ed8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ This is the container component that encapsulates the lanes and cards
170170
| laneStyle | object | CSS style for every lanes |
171171
| tagStyle | object | If cards have tags, use this prop to modify their style |
172172
| cardDragClass | string | CSS class to be applied to Card when being dragged |
173+
| cardDropClass | string | CSS class to be applied to Card when being dropped |
173174
| laneDragClass | string | CSS class to be applied to Lane when being dragged |
175+
| laneDropClass | string | CSS class to be applied to Lane when being dropped |
174176
| components | object | Map of customised components. [List](src/components/index.js) of available. |
175177

176178

src/controllers/BoardContainer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class BoardContainer extends Component {
112112
draggable,
113113
laneDraggable,
114114
laneDragClass,
115+
laneDropClass,
115116
style,
116117
onDataChange,
117118
onCardAdd,
@@ -163,7 +164,7 @@ class BoardContainer extends Component {
163164
orientation="horizontal"
164165
onDragStart={this.onDragStart}
165166
dragClass={laneDragClass}
166-
dropClass=""
167+
dropClass={laneDropClass}
167168
onDrop={this.onLaneDrop}
168169
lockAxis="x"
169170
getChildPayload={index => this.getLaneDetails(index)}
@@ -235,6 +236,7 @@ BoardContainer.propTypes = {
235236
cardDraggable: PropTypes.bool,
236237
cardDragClass: PropTypes.string,
237238
laneDragClass: PropTypes.string,
239+
laneDropClass: PropTypes.string,
238240
onCardMoveAcrossLanes: PropTypes.func.isRequired,
239241
t: PropTypes.func.isRequired,
240242
}
@@ -258,7 +260,8 @@ BoardContainer.defaultProps = {
258260
laneDraggable: true,
259261
cardDraggable: true,
260262
cardDragClass: 'react_trello_dragClass',
261-
laneDragClass: 'react_trello_dragLaneClass'
263+
laneDragClass: 'react_trello_dragLaneClass',
264+
laneDropClass: ''
262265
}
263266

264267
const mapStateToProps = state => {

src/controllers/Lane.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class Lane extends Component {
139139
hideCardDeleteIcon,
140140
cardDraggable,
141141
cardDragClass,
142+
cardDropClass,
142143
tagStyle,
143144
cardStyle,
144145
components,
@@ -177,6 +178,7 @@ class Lane extends Component {
177178
orientation="vertical"
178179
groupName={this.groupName}
179180
dragClass={cardDragClass}
181+
dropClass={cardDropClass}
180182
onDragStart={this.onDragStart}
181183
onDrop={e => this.onDragEnd(id, e)}
182184
onDragEnter={() => this.setState({isDraggingOver: true})}
@@ -285,6 +287,7 @@ Lane.propTypes = {
285287
laneDraggable: PropTypes.bool,
286288
cardDraggable: PropTypes.bool,
287289
cardDragClass: PropTypes.string,
290+
cardDropClass: PropTypes.string,
288291
canAddLanes: PropTypes.bool,
289292
t: PropTypes.func.isRequired
290293
}

0 commit comments

Comments
 (0)