Skip to content

Commit e234a94

Browse files
committed
Improve example of Alert and remove info-dark type
1 parent 960c63d commit e234a94

File tree

2 files changed

+35
-55
lines changed

2 files changed

+35
-55
lines changed

src/components/Alert/README.md

+32-45
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,40 @@
1-
Info
1+
Default
22

33
```js
4-
<Alert>
5-
Congrats! Your recovery code was printed and the app authenticator was
6-
sucessfully validated.
7-
</Alert>
4+
<div>
5+
<div className="mb5">
6+
<Alert
7+
autoClose={3000}
8+
onClose={() => console.log("Auto closed after 3000ms!")}
9+
>
10+
Congrats! Your recovery code was printed and the app authenticator was
11+
sucessfully validated.
12+
</Alert>
13+
</div>
14+
</div>
815
```
916

10-
Warning
17+
Alerts
1118

1219
```js
13-
<Alert type="warning" onClose={() => console.log("Closed!")}>
14-
This action is irreversible!
15-
</Alert>
20+
<div>
21+
<div className="mb5">
22+
<Alert type="success" onClose={() => console.log("Closed!")}>
23+
Your action was complete!
24+
</Alert>
25+
</div>
26+
27+
<div className="mb5">
28+
<Alert type="warning" onClose={() => console.log("Closed!")}>
29+
This action is irreversible!
30+
</Alert>
31+
</div>
32+
33+
<div>
34+
<Alert type="error" onClose={() => console.log("Closed!")}>
35+
You can't delete this item.
36+
</Alert>
37+
</div>
38+
</div>
1639
```
1740
18-
Error
19-
20-
```js
21-
<Alert type="error" onClose={() => console.log("Closed!")}>
22-
You can't delete this item.
23-
</Alert>
24-
```
25-
26-
Success
27-
28-
```js
29-
<Alert type="success" onClose={() => console.log("Closed!")}>
30-
Your action was complete!
31-
</Alert>
32-
```
33-
34-
Info Dark
35-
36-
```js
37-
<Alert type="info-dark" onClose={() => console.log("Closed!")}>
38-
Congrats! Your recovery code was printed and the app authenticator was
39-
sucessfully validated.
40-
</Alert>
41-
```
42-
43-
Auto Close
44-
45-
```js
46-
<Alert
47-
autoClose={3000}
48-
onClose={() => console.log("Auto closed after 3000ms!")}
49-
>
50-
Congrats! Your recovery code was printed and the app authenticator was
51-
sucessfully validated.
52-
</Alert>
53-
```

src/components/Alert/index.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Alert extends Component {
2323
let showIcon = false
2424
let Icon = 'div'
2525
let color = config.colors['serious-black']
26-
let closeBtnColor = 'near-black'
2726

2827
switch (type) {
2928
case 'success': {
@@ -47,20 +46,14 @@ class Alert extends Component {
4746
color = config.colors['yellow']
4847
break
4948
}
50-
case 'info-dark': {
51-
classes += 'bg-serious-black light-silver '
52-
color = config.colors['white']
53-
closeBtnColor = config.colors['white']
54-
break
55-
}
5649
default: {
5750
classes += 'bg-washed-blue '
5851
break
5952
}
6053
}
6154

6255
return (
63-
<div className={`flex justify-between f6 near-black ${classes}`}>
56+
<div className={`flex justify-between f5 near-black ${classes}`}>
6457
<div className="flex items-center">
6558
{showIcon && <Icon color={color} size={18} />}
6659

@@ -71,7 +64,7 @@ class Alert extends Component {
7164

7265
{onClose &&
7366
<div className="pointer flex items-center pv2" onClick={onClose}>
74-
<CloseIcon color={closeBtnColor} size={10} />
67+
<CloseIcon color={config.colors['near-black']} size={10} />
7568
</div>}
7669
</div>
7770
)
@@ -80,7 +73,7 @@ class Alert extends Component {
8073

8174
Alert.propTypes = {
8275
/** Style of the alert */
83-
type: PropTypes.oneOf(['success', 'error', 'warning', 'info', 'info-dark']),
76+
type: PropTypes.oneOf(['success', 'error', 'warning', 'info']),
8477
/** Content of the alert */
8578
children: PropTypes.node.isRequired,
8679
/** If this function is defined, a close icon will appear and this function will be called when alert is closed. */

0 commit comments

Comments
 (0)