-
Notifications
You must be signed in to change notification settings - Fork 486
/
Copy pathDeprecations.story.js
122 lines (115 loc) · 3.63 KB
/
Deprecations.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import React, {Component} from 'react'
import {storiesOf} from '@storybook/react'
import Board from '../src'
import './board.css'
const data = require('./data/base.json')
const CustomLaneHeader = props => {
const buttonHandler = () => {
alert(`The label passed to the lane was: ${props.label}. The lane has ${props.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'}}>{props.title}</div>
{props.label && (
<div style={{width: '30%', textAlign: 'right', fontSize: 13}}>
<button onClick={buttonHandler} style={{cursor: 'pointer'}}>
?
</button>
</div>
)}
</header>
</div>
)
}
class NewCard extends Component {
updateField = (field, evt) => {
this.setState({[field]: evt.target.value})
}
handleAdd = () => {
this.props.onAdd(this.state)
}
render() {
const {onCancel} = this.props
return (
<div style={{background: 'white', borderRadius: 3, border: '1px solid #eee', borderBottom: '1px solid #ccc'}}>
<div style={{padding: 5, margin: 5}}>
<div>
<div style={{marginBottom: 5}}>
<input type="text" onChange={evt => this.updateField('title', evt)} placeholder="Title" />
</div>
<div style={{marginBottom: 5}}>
<input type="text" onChange={evt => this.updateField('description', evt)} placeholder="Description" />
</div>
</div>
<button onClick={this.handleAdd}>Add</button>
<button onClick={onCancel}>Cancel</button>
</div>
</div>
)
}
}
const CustomCard = props => {
return (
<div style={{padding: 6}}>
<header
style={{
borderBottom: '1px solid #eee',
paddingBottom: 6,
marginBottom: 10,
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
color: props.cardColor
}}>
<div style={{fontSize: 14, fontWeight: 'bold'}}>{props.name}</div>
<div style={{fontSize: 11}}>{props.dueOn}</div>
</header>
<div style={{fontSize: 12, color: '#BD3B36'}}>
<div style={{color: '#4C4C4C', fontWeight: 'bold'}}>{props.subTitle}</div>
<div style={{padding: '5px 0px'}}>
<i>{props.body}</i>
</div>
<div style={{marginTop: 10, textAlign: 'center', color: props.cardColor, fontSize: 15, fontWeight: 'bold'}}>{props.escalationText}</div>
{props.tags && (
<div
style={{
borderTop: '1px solid #eee',
paddingTop: 6,
display: 'flex',
justifyContent: 'flex-end',
flexDirection: 'row',
flexWrap: 'wrap'
}}>
{props.tags.map(tag => (
<Tag key={tag.title} {...tag} tagStyle={props.tagStyle} />
))}
</div>
)}
</div>
</div>
)
}
storiesOf('Deprecation warnings', module).add(
'v2.2 warnings',
() => <Board
data={data}
editable
addCardLink={<button>New Card</button>}
customLaneHeader={<CustomLaneHeader />}
newLaneTemplate={<div>new lane</div>}
newCardTemplate={<NewCard />}
customCardLayout
>
<CustomCard />
</Board>,
{info: 'Example of usage legacy props: addCardLink, customCardLayout, customLaneHeader, newLaneTemplate, newCardTemplate'}
)