Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7736e3b

Browse files
committed
fix alert styles
1 parent8f6670d commit7736e3b

File tree

5 files changed

+28
-29
lines changed

5 files changed

+28
-29
lines changed

‎lib/actions/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function testResult(result) {
1818
varfilter=getTestFilter(result);
1919
varalert={
2020
message:result.msg,
21-
action:'note',
21+
action:'NOTE',
2222
};
2323
if(filter==='PASS'||filter==='FAIL'){
2424
dispatch(hint_1.hintPositionSet(0));
@@ -27,7 +27,7 @@ function testResult(result) {
2727
duration:1200,
2828
});
2929
}
30-
elseif(filter==='FAIL'&&progress.pages[pagePosition]){
30+
if(filter==='FAIL'&&progress.pages[pagePosition]){
3131
dispatch(progress_1.completePage(false));
3232
alert=Object.assign({},alert,{
3333
action:filter,
@@ -43,7 +43,7 @@ function getTestFilter(result) {
4343
switch(true){
4444
caseresult.pass&&result.change>0:
4545
return'PASS';
46-
caseresult.pass===false&&result.change<1:
46+
caseresult.pass===false&&result.change<=0:
4747
return'FAIL';
4848
default:
4949
return'NOTE';

‎lib/reducers/alert/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ var colors = {
1717
NOTE:'#9DA5B4',
1818
};
1919
varcurrent=_alert;
20-
functionsetAlert(options,color){
21-
if(color){
22-
varstatusBarAlert=document.getElementsByClassName('cr-alert-replay')[0];
23-
statusBarAlert.style.color=color;
24-
}
25-
current=Object.assign({},open,options);
26-
returncurrent;
20+
functionsetAlert(a){
21+
varcolor=colors[a.action]||colors.NOTE;
22+
varstatusBarAlert=document.getElementsByClassName('cr-alert-replay')[0];
23+
statusBarAlert.style.color=color;
24+
returnObject.assign({},open,a);
2725
}
2826
functionalertReducer(alert,action){
2927
if(alert===void0){alert=_alert;}
@@ -35,7 +33,7 @@ function alertReducer(alert, action) {
3533
if(!a){
3634
return_alert;
3735
}
38-
returnsetAlert(a,colors[a.action]||colors.NOTE);
36+
returnsetAlert(a);
3937
default:
4038
returnalert;
4139
}

‎src/actions/test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ export function testResult(result: Test.Result): ReduxThunk.ThunkInterface {
2020
constfilter:string=getTestFilter(result);
2121
letalert:CR.Alert={
2222
message:result.msg,
23-
action:'note',
23+
action:'NOTE',
2424
};
25+
// passes or fails
2526
if(filter==='PASS'||filter==='FAIL'){
2627
dispatch(hintPositionSet(0));
2728
alert=Object.assign({},alert,{
2829
action:filter,
2930
duration:1200,
3031
});
31-
}elseif(filter==='FAIL'&&progress.pages[pagePosition]){
32+
}
33+
// previously passed, but now fails
34+
if(filter==='FAIL'&&progress.pages[pagePosition]){
3235
dispatch(completePage(false));
3336
alert=Object.assign({},alert,{
3437
action:filter,
@@ -44,7 +47,7 @@ function getTestFilter(result: Test.Result): string {
4447
switch(true){
4548
caseresult.pass&&result.change>0:
4649
return'PASS';
47-
caseresult.pass===false&&result.change<1:
50+
caseresult.pass===false&&result.change<=0:
4851
return'FAIL';
4952
default:
5053
return'NOTE';

‎src/components/Alert/_alert.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@import"ui-variables";
2-
.cr-alert.passbuttonspan {
2+
.cr-alert.PASSbuttonspan {
33
color:@background-color-success;
44
}
5-
.cr-alert.failbuttonspan {
5+
.cr-alert.FAILbuttonspan {
66
color:@background-color-error;
77
}
8-
.cr-alert.notebuttonspan {
8+
.cr-alert.NOTEbuttonspan {
99
color:@background-color-info;
1010
}
1111
.cr-alert-replay {

‎src/reducers/alert/index.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,19 @@ const open = {
1717
};
1818

1919
constcolors={
20-
PASS:'#73C990',
21-
FAIL:'#FF4081',
22-
NOTE:'#9DA5B4',
20+
PASS:'#73C990',// green
21+
FAIL:'#FF4081',// red
22+
NOTE:'#9DA5B4',// blue
2323
};
2424

2525
letcurrent:CR.Alert=_alert;
2626

27-
functionsetAlert(options:Object,color?:string){
28-
if(color){
29-
letstatusBarAlert=<HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
30-
statusBarAlert.style.color=color;
31-
}
32-
current=Object.assign({},open,options);
33-
returncurrent;
27+
functionsetAlert(a:CR.Alert):CR.Alert{
28+
29+
constcolor=colors[a.action]||colors.NOTE;
30+
letstatusBarAlert=<HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
31+
statusBarAlert.style.color=color;
32+
returnObject.assign({},open,a);
3433
}
3534

3635
exportdefaultfunctionalertReducer(
@@ -48,8 +47,7 @@ export default function alertReducer(
4847
// close alert
4948
return_alert;
5049
}
51-
52-
returnsetAlert(a,colors[a.action]||colors.NOTE);
50+
returnsetAlert(a);
5351

5452
default:
5553
returnalert;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp