Skip to content

Commit e4634f4

Browse files
committed
fix(Add Card Title): Pass add card title props to lane
#170
1 parent fb5cebd commit e4634f4

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

src/components/Lane.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ class Lane extends Component {
9898
}
9999

100100
renderAddCardLink = () => {
101-
const {addCardLink} = this.props
101+
const {addCardLink, addCardTitle} = this.props
102102
if (addCardLink) {
103103
return <span onClick={this.showEditableCard}>{addCardLink}</span>
104104
} else {
105-
return <AddCardLink onClick={this.showEditableCard}>Add Card</AddCardLink>
105+
return <AddCardLink onClick={this.showEditableCard}>{addCardTitle}</AddCardLink>
106106
}
107107
}
108108

@@ -116,7 +116,7 @@ class Lane extends Component {
116116
})
117117
return <span>{newCardWithProps}</span>
118118
} else {
119-
return <NewCard onCancel={this.hideEditableCard} onAdd={this.addNewCard} />
119+
return <NewCard onCancel={this.hideEditableCard} onAdd={this.addNewCard}/>
120120
}
121121
}
122122

@@ -283,6 +283,7 @@ Lane.propTypes = {
283283
onLaneClick: PropTypes.func,
284284
newCardTemplate: PropTypes.node,
285285
addCardLink: PropTypes.node,
286+
addCardTitle: PropTypes.string,
286287
editable: PropTypes.bool,
287288
cardDraggable: PropTypes.bool,
288289
cardDragClass: PropTypes.string

stories/EditableBoard.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ storiesOf('Editable Board', module)
7979
.add(
8080
'New Card Template',
8181
() => {
82-
return <Board data={data} editable newCardTemplate={<NewCard />} />
82+
return <Board data={data} editable newCardTemplate={<NewCard />} addCardTitle='Click to add'/>
8383
},
8484
{info: 'Pass a custom new card template to add card'}
8585
)

tests/__snapshots__/Storyshots.test.js.snap

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23137,7 +23137,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2313723137
className="sc-jzJRlG BFmJH"
2313823138
onClick={[Function]}
2313923139
>
23140-
Add Card
23140+
Click to add
2314123141
</a>
2314223142
</div>
2314323143
</section>
@@ -23228,7 +23228,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2322823228
className="sc-jzJRlG BFmJH"
2322923229
onClick={[Function]}
2323023230
>
23231-
Add Card
23231+
Click to add
2323223232
</a>
2323323233
</div>
2323423234
</section>
@@ -23277,7 +23277,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2327723277
className="sc-jzJRlG BFmJH"
2327823278
onClick={[Function]}
2327923279
>
23280-
Add Card
23280+
Click to add
2328123281
</a>
2328223282
</div>
2328323283
</section>
@@ -23409,7 +23409,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2340923409
className="sc-jzJRlG BFmJH"
2341023410
onClick={[Function]}
2341123411
>
23412-
Add Card
23412+
Click to add
2341323413
</a>
2341423414
</div>
2341523415
</section>
@@ -23500,7 +23500,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2350023500
className="sc-jzJRlG BFmJH"
2350123501
onClick={[Function]}
2350223502
>
23503-
Add Card
23503+
Click to add
2350423504
</a>
2350523505
</div>
2350623506
</section>
@@ -23591,7 +23591,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2359123591
className="sc-jzJRlG BFmJH"
2359223592
onClick={[Function]}
2359323593
>
23594-
Add Card
23594+
Click to add
2359523595
</a>
2359623596
</div>
2359723597
</section>
@@ -23682,7 +23682,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2368223682
className="sc-jzJRlG BFmJH"
2368323683
onClick={[Function]}
2368423684
>
23685-
Add Card
23685+
Click to add
2368623686
</a>
2368723687
</div>
2368823688
</section>
@@ -23773,7 +23773,7 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2377323773
className="sc-jzJRlG BFmJH"
2377423774
onClick={[Function]}
2377523775
>
23776-
Add Card
23776+
Click to add
2377723777
</a>
2377823778
</div>
2377923779
</section>
@@ -23952,7 +23952,10 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2395223952
</span>
2395323953
<span>
2395423954
<span>
23955-
23955+
<span>
23956+
<br />
23957+
  
23958+
</span>
2395623959
<span
2395723960
style={Object {}}
2395823961
>
@@ -24355,15 +24358,21 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2435524358
</span>
2435624359
</span>
2435724360
<span>
24358-
24361+
<span>
24362+
<br />
24363+
  
24364+
</span>
2435924365
<span
2436024366
style={Object {}}
2436124367
>
2436224368
editable
2436324369
</span>
2436424370
</span>
2436524371
<span>
24366-
24372+
<span>
24373+
<br />
24374+
  
24375+
</span>
2436724376
<span
2436824377
style={Object {}}
2436924378
>
@@ -24387,7 +24396,37 @@ exports[`Storyshots Editable Board New Card Template 1`] = `
2438724396
}
2438824397
</span>
2438924398
</span>
24390-
24399+
</span>
24400+
<span>
24401+
<span>
24402+
<br />
24403+
  
24404+
</span>
24405+
<span
24406+
style={Object {}}
24407+
>
24408+
addCardTitle
24409+
</span>
24410+
<span>
24411+
=
24412+
<span
24413+
style={Object {}}
24414+
>
24415+
"
24416+
<span
24417+
style={
24418+
Object {
24419+
"color": "#22a",
24420+
"wordBreak": "break-word",
24421+
}
24422+
}
24423+
>
24424+
Click to add
24425+
</span>
24426+
"
24427+
</span>
24428+
</span>
24429+
<br />
2439124430
</span>
2439224431
</span>
2439324432
<span

0 commit comments

Comments
 (0)