@@ -76,19 +76,6 @@ class Lane extends Component {
7676 )
7777 }
7878
79- sameCards = ( cardsA , cardsB ) => {
80- return (
81- cardsA . length === cardsB . length &&
82- cardsA . every (
83- ( el , ix ) =>
84- el . id === cardsB [ ix ] . id &&
85- el . title === cardsB [ ix ] . title &&
86- el . label === cardsB [ ix ] . label &&
87- el . description === cardsB [ ix ] . description
88- )
89- )
90- }
91-
9279 componentWillReceiveProps ( nextProps ) {
9380 if ( ! isEqual ( this . props . cards , nextProps . cards ) ) {
9481 this . setState ( { cards : nextProps . cards , currentPage : nextProps . currentPage } )
@@ -142,6 +129,15 @@ class Lane extends Component {
142129 }
143130 }
144131
132+ renderNewCard = ( ) => {
133+ const { newCardTemplate} = this . props
134+ if ( newCardTemplate ) {
135+ const newCardWithProps = React . cloneElement ( newCardTemplate , { onCancel : this . hideEditableCard , onAdd : this . addNewCard } )
136+ return < span > { newCardWithProps } </ span >
137+ } else {
138+ return < NewCard onCancel = { this . hideEditableCard } onAdd = { this . addNewCard } />
139+ }
140+ }
145141
146142 renderDragContainer = ( ) => {
147143 const { connectDropTarget, laneSortFunction, editable, tagStyle, cardStyle, draggable} = this . props
@@ -176,7 +172,7 @@ class Lane extends Component {
176172 < div >
177173 < DraggableList > { cardList } </ DraggableList >
178174 { editable && ! addCardMode && this . renderAddCardLink ( ) }
179- { addCardMode && < NewCard onCancel = { this . hideEditableCard } onAdd = { this . addNewCard } /> }
175+ { addCardMode && this . renderNewCard ( ) }
180176 </ div >
181177 )
182178 }
@@ -229,6 +225,7 @@ Lane.propTypes = {
229225 onCardClick : PropTypes . func ,
230226 onCardDelete : PropTypes . func ,
231227 onCardAdd : PropTypes . func ,
228+ newCardTemplate : PropTypes . node ,
232229 addCardLink : PropTypes . node ,
233230 editable : PropTypes . bool
234231}
0 commit comments