Skip to content

Commit 0873274

Browse files
committed
fix(Fix the delete button and console errors):
#177
1 parent d3da37f commit 0873274

File tree

9 files changed

+216
-465
lines changed

9 files changed

+216
-465
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"plugins": [
1414
"@babel/plugin-proposal-class-properties",
1515
"@babel/plugin-transform-async-to-generator",
16-
"@babel/plugin-transform-runtime",
17-
"@babel/plugin-transform-template-literals"
16+
"@babel/plugin-transform-runtime"
1817
]
1918
}

.storybook/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ addDecorator(
99
goFullScreen: false,
1010
showStoriesPanel: true,
1111
showSearchBox: false,
12-
addonPanelInRight: false
12+
addonPanelInRight: false,
13+
showAddonPanel: false
1314
})
1415
)
1516

src/components/BoardContainer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ class BoardContainer extends Component {
117117
}
118118

119119
render() {
120-
const {id, reducerData, draggable, laneDraggable, laneDragClass, style, addLaneTitle, editable, canAddLanes, ...otherProps} = this.props
121-
const {addLaneMode} = this.state
120+
const {id, reducerData, draggable, laneDraggable, laneDragClass, style, onDataChange, addLaneTitle, editable, canAddLanes, ...otherProps} = this.props
122121
// Stick to whitelisting attributes to segregate board and lane props
123122
const passthroughProps = pick(this.props, [
124123
'onLaneScroll',

src/components/Card.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,20 @@ class Card extends Component {
2525
<CardRightContent>{label}</CardRightContent>
2626
</CardHeader>
2727
<Detail>{description}</Detail>
28-
{tags && <Footer>{tags.map(tag => <Tag key={tag.title} {...tag} tagStyle={this.props.tagStyle} />)}</Footer>}
28+
{tags && (
29+
<Footer>
30+
{tags.map(tag => (
31+
<Tag key={tag.title} {...tag} tagStyle={this.props.tagStyle} />
32+
))}
33+
</Footer>
34+
)}
2935
</span>
3036
)
3137
}
3238
}
3339

3440
render() {
35-
const {id, cardStyle, editable, hideCardDeleteIcon, customCardLayout, dragStyle, ...otherProps} = this.props
41+
const {id, cardStyle, editable, hideCardDeleteIcon, customCardLayout, dragStyle, onDelete, ...otherProps} = this.props
3642
const style = customCardLayout ? {...cardStyle, padding: 0} : cardStyle
3743
return (
3844
<MovableCardWrapper

src/components/Lane.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -129,7 +129,7 @@ class Lane extends Component {
129129
return this.props.droppable && sourceContainerOptions.groupName === this.groupName
130130
}
131131

132-
get groupName() {
132+
get groupName() {
133133
const {boardId} = this.props
134134
return `TrelloBoard${boardId}Lane`
135135
}
@@ -149,18 +149,7 @@ class Lane extends Component {
149149
}
150150

151151
renderDragContainer = isDraggingOver => {
152-
const {
153-
laneSortFunction,
154-
editable,
155-
hideCardDeleteIcon,
156-
tagStyle,
157-
cardStyle,
158-
draggable,
159-
cardDraggable,
160-
cards,
161-
cardDragClass,
162-
id
163-
} = this.props
152+
const {laneSortFunction, editable, hideCardDeleteIcon, tagStyle, cardStyle, draggable, cardDraggable, cards, cardDragClass, id} = this.props
164153
const {addCardMode, collapsed} = this.state
165154

166155
const showableCards = collapsed ? [] : cards
@@ -182,15 +171,11 @@ class Lane extends Component {
182171
{...card}
183172
/>
184173
)
185-
return draggable && cardDraggable ? (
186-
<Draggable key={card.id}>{cardToRender}</Draggable>
187-
) : (
188-
<span key={card.id}>{cardToRender}</span>
189-
)
174+
return draggable && cardDraggable ? <Draggable key={card.id}>{cardToRender}</Draggable> : <span key={card.id}>{cardToRender}</span>
190175
})
191176

192177
return (
193-
<ScrollableLane innerRef={this.laneDidMount} isDraggingOver={isDraggingOver}>
178+
<ScrollableLane ref={this.laneDidMount} isDraggingOver={isDraggingOver}>
194179
<Container
195180
orientation="vertical"
196181
groupName={this.groupName}
@@ -243,7 +228,7 @@ class Lane extends Component {
243228

244229
render() {
245230
const {loading, isDraggingOver} = this.state
246-
const {id, onLaneClick, ...otherProps} = this.props
231+
const {id, onLaneClick, onCardAdd, ...otherProps} = this.props
247232
return (
248233
<Section {...otherProps} key={id} onClick={() => onLaneClick && onLaneClick(id)} draggable={false} className="react-trello-lane">
249234
{this.renderHeader()}
@@ -302,4 +287,7 @@ const mapDispatchToProps = dispatch => ({
302287
actions: bindActionCreators(laneActions, dispatch)
303288
})
304289

305-
export default connect(null, mapDispatchToProps)(Lane)
290+
export default connect(
291+
null,
292+
mapDispatchToProps
293+
)(Lane)

src/components/widgets/DeleteButton.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react'
2-
import {DeleteWrapper, DeleteIcon} from '../../styles/Elements'
2+
import {DeleteWrapper, DelButton} from '../../styles/Elements'
33

44
const DeleteButton = props => {
55
return (
66
<DeleteWrapper {...props}>
7-
<DeleteIcon />
7+
<DelButton>x</DelButton>
88
</DeleteWrapper>
99
)
1010
}

src/styles/Base.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export const GlobalStyle = createGlobalStyle`
1818
1919
.react_trello_dragLaneClass {
2020
transform: rotate(3deg);
21-
}
22-
21+
}
2322
`
2423

2524
export const BoardDiv = styled.div`

src/styles/Elements.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
11
import styled from 'styled-components'
2-
import {CardWrapper} from './Base'
2+
import {CardWrapper, MovableCardWrapper} from './Base'
33

44
export const DeleteWrapper = styled.div`
55
text-align: center;
66
position: absolute;
7-
top: -6px;
8-
right: -1px;
7+
top: -1px;
8+
right: 2px;
9+
`
10+
11+
export const DelButton = styled.button`
12+
font-weight: bold;
13+
border: none;
14+
display: inline-block;
15+
font-size: 8px;
16+
opacity: 0;
17+
height: 15px;
18+
line-height: 1px;
19+
margin: 0 0 8px;
20+
padding: 0;
21+
text-align: center;
22+
width: 15px;
23+
background: inherit;
24+
cursor: pointer;
25+
26+
${MovableCardWrapper}:hover & {
27+
opacity: 1;
28+
}
929
`
1030

1131
export const DeleteIcon = styled.span`
1232
position: relative;
1333
display: inline-block;
1434
width: 4px;
1535
height: 4px;
16-
opacity: 0;
36+
opacity: 1;
1737
overflow: hidden;
1838
border: 1px solid #83bd42;
1939
border-radius: 50%;
@@ -62,7 +82,6 @@ export const ExpandCollapseBase = styled.span`
6282
font-size: 14px;
6383
position: relative;
6484
cursor: pointer;
65-
6685
`
6786

6887
export const CollapseBtn = styled(ExpandCollapseBase)`
@@ -140,15 +159,15 @@ export const CancelButton = styled.button`
140159
margin-bottom: 0;
141160
`
142161
export const NewLaneButton = styled.button`
143-
background: #2B6AA3;
144-
border: none;
162+
background: #2b6aa3;
163+
border: none;
145164
color: #fff;
146165
transition: background 0.3s ease;
147166
min-height: 32px;
148167
padding: 4px 16px;
149168
vertical-align: top;
150-
margin-top: 0;
151-
margin-right: 0px;
169+
margin-top: 0;
170+
margin-right: 0px;
152171
border-radius: 4px;
153172
font-size: 13px;
154173
cursor: pointer;

0 commit comments

Comments
 (0)