Skip to content

Commit dcd6ab8

Browse files
committed
fix(stories): Add DeleteIcon into CustomCard story
fix #306
1 parent 4b2101b commit dcd6ab8

File tree

2 files changed

+80
-4
lines changed

2 files changed

+80
-4
lines changed

stories/CustomCard.story.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
import React from 'react'
22
import {storiesOf} from '@storybook/react'
33
import {MovableCardWrapper } from 'rt/styles/Base'
4+
import DeleteButton from 'rt/widgets/DeleteButton'
45

56
import Board from '../src'
67
import Tag from 'rt/components/Card/Tag'
78

8-
const CustomCard = ({onClick, className, name, cardStyle, body, dueOn, cardColor, subTitle, tagStyle, escalationText, tags}) => {
9+
const CustomCard = ({
10+
onClick,
11+
className,
12+
name,
13+
cardStyle,
14+
body,
15+
dueOn,
16+
cardColor,
17+
subTitle,
18+
tagStyle,
19+
escalationText,
20+
tags,
21+
showDeleteButton,
22+
onDelete,
23+
}) => {
24+
const clickDelete = e => {
25+
onDelete()
26+
e.stopPropagation()
27+
}
28+
929
return (
1030
<MovableCardWrapper
1131
onClick={onClick}
@@ -24,6 +44,7 @@ const CustomCard = ({onClick, className, name, cardStyle, body, dueOn, cardColor
2444
}}>
2545
<div style={{fontSize: 14, fontWeight: 'bold'}}>{name}</div>
2646
<div style={{fontSize: 11}}>{dueOn}</div>
47+
{showDeleteButton && <DeleteButton onClick={clickDelete} />}
2748
</header>
2849
<div style={{fontSize: 12, color: '#BD3B36'}}>
2950
<div style={{color: '#4C4C4C', fontWeight: 'bold'}}>{subTitle}</div>

tests/__snapshots__/Storyshots.test.js.snap

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14790,13 +14790,38 @@ exports[`Storyshots Custom Components Card 1`] = `
1479014790
color: #000;
1479114791
}
1479214792

14793-
.c8 {
14793+
.c10 {
1479414794
padding: 2px 3px;
1479514795
border-radius: 3px;
1479614796
margin: 2px 5px;
1479714797
font-size: 70%;
1479814798
}
1479914799

14800+
.c8 {
14801+
text-align: center;
14802+
position: absolute;
14803+
top: -1px;
14804+
right: 2px;
14805+
cursor: pointer;
14806+
}
14807+
14808+
.c9 {
14809+
-webkit-transition: all 0.5s ease;
14810+
transition: all 0.5s ease;
14811+
display: inline-block;
14812+
border: none;
14813+
font-size: 8px;
14814+
height: 15px;
14815+
line-height: 1px;
14816+
margin: 0 0 8px;
14817+
padding: 0;
14818+
text-align: center;
14819+
width: 15px;
14820+
background: inherit;
14821+
cursor: pointer;
14822+
opacity: 0;
14823+
}
14824+
1480014825
.c6:hover .c9 {
1480114826
opacity: 1;
1480214827
}
@@ -15015,6 +15040,16 @@ exports[`Storyshots Custom Components Card 1`] = `
1501515040
>
1501615041
due in a day
1501715042
</div>
15043+
<div
15044+
className="c8"
15045+
onClick={[Function]}
15046+
>
15047+
<button
15048+
className="c9"
15049+
>
15050+
15051+
</button>
15052+
</div>
1501815053
</header>
1501915054
<div
1502015055
style={
@@ -15107,6 +15142,16 @@ exports[`Storyshots Custom Components Card 1`] = `
1510715142
>
1510815143
due now
1510915144
</div>
15145+
<div
15146+
className="c8"
15147+
onClick={[Function]}
15148+
>
15149+
<button
15150+
className="c9"
15151+
>
15152+
15153+
</button>
15154+
</div>
1511015155
</header>
1511115156
<div
1511215157
style={
@@ -15229,6 +15274,16 @@ exports[`Storyshots Custom Components Card 1`] = `
1522915274
>
1523015275
due in a day
1523115276
</div>
15277+
<div
15278+
className="c8"
15279+
onClick={[Function]}
15280+
>
15281+
<button
15282+
className="c9"
15283+
>
15284+
15285+
</button>
15286+
</div>
1523215287
</header>
1523315288
<div
1523415289
style={
@@ -15285,7 +15340,7 @@ exports[`Storyshots Custom Components Card 1`] = `
1528515340
}
1528615341
>
1528715342
<span
15288-
className="c8"
15343+
className="c10"
1528915344
style={
1529015345
Object {
1529115346
"backgroundColor": "red",
@@ -15297,7 +15352,7 @@ exports[`Storyshots Custom Components Card 1`] = `
1529715352
Critical
1529815353
</span>
1529915354
<span
15300-
className="c8"
15355+
className="c10"
1530115356
style={
1530215357
Object {
1530315358
"backgroundColor": "#0079BF",

0 commit comments

Comments
 (0)