Skip to content

Commit b28a45c

Browse files
committed
repair alert colors: green, pink, blue
1 parent ffa3c6c commit b28a45c

File tree

8 files changed

+30
-15
lines changed

8 files changed

+30
-15
lines changed

lib/components/Alert/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ var defaultAlert = {
2323
action: 'NOTE',
2424
};
2525
var styles = {
26-
display: 'inline-block',
27-
margin: '0px 10px',
26+
snackbar: {
27+
display: 'inline-block',
28+
margin: '0px 10px',
29+
},
2830
};
2931
var Alert = (function (_super) {
3032
__extends(Alert, _super);
@@ -33,8 +35,8 @@ var Alert = (function (_super) {
3335
}
3436
Alert.prototype.render = function () {
3537
var _a = this.props, alert = _a.alert, alertClose = _a.alertClose;
36-
var action = alert.action, message = alert.message, open = alert.open, duration = alert.duration, color = alert.color;
37-
return (React.createElement(Snackbar_1.default, {style: styles, bodyStyle: { color: color }, open: open, action: action || 'NOTE', message: message || '', autoHideDuration: duration || 2000, onActionTouchTap: alertClose, onRequestClose: alertClose}));
38+
var action = alert.action, message = alert.message, open = alert.open, duration = alert.duration;
39+
return (React.createElement(Snackbar_1.default, {className: 'cr-alert ' + action, style: styles.snackbar, open: open, action: action || 'NOTE', message: message || '', autoHideDuration: duration || 2000, onActionTouchTap: alertClose, onRequestClose: alertClose}));
3840
};
3941
Alert = __decorate([
4042
react_redux_1.connect(function (state) { return ({

lib/modules/alert/reducer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ var _alert = {
1010
open: false,
1111
action: 'NOTE',
1212
duration: 1500,
13-
color: colors.NOTE
13+
color: colors.NOTE,
1414
};
1515
var open = {
1616
open: true,
1717
action: 'NOTE',
18-
duration: 1500
18+
duration: 1500,
1919
};
2020
var current = _alert;
2121
function setAlert(a) {

lib/store.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ var core_coderoad_1 = require('core-coderoad');
44
Object.defineProperty(exports, "__esModule", { value: true });
55
exports.default = core_coderoad_1.configureStore({
66
reducer: reducers_1.default,
7-
devMode: false,
7+
devMode: true,
88
throttle: { TEST_RUN: 800 },
99
});

src/components/Alert/_alert.less

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Style Alert Button */
2+
.cr-alert.PASS > div > div > button > div > span {
3+
color: #73C990; // green
4+
}
5+
.cr-alert.FAIL > div > div > button > div > span {
6+
color: #FF4081; // pink
7+
}
8+
.cr-alert.NOTE > div > div > button > div > span {
9+
color: #9DA5B4; // blue
10+
}

src/components/Alert/index.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ const defaultAlert = {
1111
};
1212

1313
const styles = {
14-
display: 'inline-block',
15-
margin: '0px 10px',
14+
snackbar: {
15+
display: 'inline-block',
16+
margin: '0px 10px',
17+
},
1618
};
1719

1820
@connect(state => ({
@@ -23,11 +25,11 @@ export default class Alert extends React.Component<{
2325
}, {}> {
2426
public render() {
2527
const {alert, alertClose} = this.props;
26-
const {action, message, open, duration, color} = alert;
28+
const {action, message, open, duration} = alert;
2729
return (
2830
<Snackbar
29-
style={styles}
30-
bodyStyle={{color}}
31+
className={'cr-alert ' + action}
32+
style={styles.snackbar}
3133
open={open}
3234
action={action || 'NOTE'}
3335
message={message || ''}

src/components/styles/index.less

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import 'ui-variables';
22
@import '../AppMenu/_app-menu';
3+
@import '../Alert/_alert';
34
#crv {
45
position: relative;
56
overflow-y: scroll;

src/modules/alert/reducer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ const _alert: CR.Alert = {
1111
open: false,
1212
action: 'NOTE',
1313
duration: 1500,
14-
color: colors.NOTE
14+
color: colors.NOTE,
1515
};
1616

1717
const open = {
1818
open: true,
1919
action: 'NOTE',
20-
duration: 1500
20+
duration: 1500,
2121
};
2222

2323
let current: CR.Alert = _alert;

src/store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import {configureStore} from 'core-coderoad';
33

44
export default configureStore({
55
reducer,
6-
devMode: false,
6+
devMode: true,
77
throttle: { TEST_RUN: 800 },
88
});

0 commit comments

Comments
 (0)