-
Notifications
You must be signed in to change notification settings - Fork 484
/
CustomLaneHeader.story.js
80 lines (76 loc) · 2.25 KB
/
CustomLaneHeader.story.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import React from 'react'
import {storiesOf} from '@storybook/react'
import Board from '../src'
const CustomLaneHeader = ({label, cards, title, current, target}) => {
const buttonHandler = () => {
alert(`The label passed to the lane was: ${label}. The lane has ${cards.length} cards!`)
}
return (
<div>
<header
style={{
borderBottom: '2px solid #c5c5c5',
paddingBottom: 6,
marginBottom: 10,
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between'
}}>
<div style={{fontSize: 14, fontWeight: 'bold'}}>{title}</div>
{label && (
<div style={{width: '30%', textAlign: 'right', fontSize: 13}}>
<button onClick={buttonHandler} style={{cursor: 'pointer'}}>
?
</button>
</div>
)}
</header>
<div>Percentage: {current || 0}/{target}</div>
</div>
)
}
storiesOf('Custom Components', module).add(
'LaneHeader',
() => {
const data = {
lanes: [
{
id: 'lane1',
title: 'Planned Tasks',
current: "70", // custom property
target: "100", // custom property
label: 'First Lane here',
cards: [
{
id: 'Card1',
title: 'John Smith',
description: 'Thanks. Please schedule me for an estimate on Monday.'
},
{
id: 'Card2',
title: 'Card Weathers',
description: 'Email received at 1:14pm'
}
]
},
{
id: 'lane2',
title: 'Completed Tasks',
label: 'Second Lane here',
current: "30", // custom property
target: "100", // custom property
cards: [
{
id: 'Card3',
title: 'Michael Caine',
description: 'You are welcome. Interested in doing business with you' + ' again',
tags: [{title: 'Critical', color: 'white', bgcolor: 'red'}, {title: '2d ETA', color: 'white', bgcolor: '#0079BF'}]
}
]
}
]
}
return <Board data={data} components={{LaneHeader: CustomLaneHeader}} />
},
{info: 'Style your lane header appearance'}
)