Skip to content

Commit 1d21d9c

Browse files
committed
[Fixes #312] Lane metadata not being passed to CustomLaneHeader
1 parent 51c2bad commit 1d21d9c

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/controllers/Lane.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,8 @@ class Lane extends Component {
204204
this.props.onLaneUpdate(this.props.id, {title: value})
205205
}
206206

207-
renderHeader = () => {
207+
renderHeader = (pickedProps) => {
208208
const {components} = this.props
209-
const pickedProps = pick(this.props, [
210-
'id',
211-
'label',
212-
'title',
213-
'titleStyle',
214-
'cards',
215-
'labelStyle',
216-
't',
217-
'editLaneTitle',
218-
'canAddLanes',
219-
'laneDraggable',
220-
])
221209
return (
222210
<components.LaneHeader
223211
{...pickedProps}
@@ -258,7 +246,7 @@ class Lane extends Component {
258246
onClick={() => onLaneClick && onLaneClick(id)}
259247
draggable={false}
260248
className={allClassNames}>
261-
{this.renderHeader()}
249+
{this.renderHeader({id, cards, ...otherProps})}
262250
{this.renderDragContainer(isDraggingOver)}
263251
{loading && <components.Loader />}
264252
{showFooter && <components.LaneFooter onClick={this.toggleLaneCollapsed} collapsed={collapsed} />}

stories/CustomLaneHeader.story.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {storiesOf} from '@storybook/react'
33

44
import Board from '../src'
55

6-
const CustomLaneHeader = props => {
6+
const CustomLaneHeader = ({label, cards, title, current, target}) => {
77
const buttonHandler = () => {
8-
alert(`The label passed to the lane was: ${props.label}. The lane has ${props.cards.length} cards!`)
8+
alert(`The label passed to the lane was: ${label}. The lane has ${cards.length} cards!`)
99
}
1010
return (
1111
<div>
@@ -18,15 +18,16 @@ const CustomLaneHeader = props => {
1818
flexDirection: 'row',
1919
justifyContent: 'space-between'
2020
}}>
21-
<div style={{fontSize: 14, fontWeight: 'bold'}}>{props.title}</div>
22-
{props.label && (
21+
<div style={{fontSize: 14, fontWeight: 'bold'}}>{title}</div>
22+
{label && (
2323
<div style={{width: '30%', textAlign: 'right', fontSize: 13}}>
2424
<button onClick={buttonHandler} style={{cursor: 'pointer'}}>
2525
?
2626
</button>
2727
</div>
2828
)}
2929
</header>
30+
<div>Percentage: {current || 0}/{target}</div>
3031
</div>
3132
)
3233
}
@@ -39,6 +40,8 @@ storiesOf('Custom Components', module).add(
3940
{
4041
id: 'lane1',
4142
title: 'Planned Tasks',
43+
current: "70", // custom property
44+
target: "100", // custom property
4245
label: 'First Lane here',
4346
cards: [
4447
{
@@ -57,6 +60,8 @@ storiesOf('Custom Components', module).add(
5760
id: 'lane2',
5861
title: 'Completed Tasks',
5962
label: 'Second Lane here',
63+
current: "30", // custom property
64+
target: "100", // custom property
6065
cards: [
6166
{
6267
id: 'Card3',

0 commit comments

Comments
 (0)