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

Commitf509ff5

Browse files
committed
update/fix alert styles
1 parentb5dbafa commitf509ff5

File tree

3 files changed

+53
-63
lines changed

3 files changed

+53
-63
lines changed

‎lib/reducers/alert/index.js

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,62 @@ var _alert = {
77
};
88
varopen={
99
open:true,
10-
pass:true,
10+
action:'pass',
1111
};
1212
varcurrent=_alert;
13+
functionsetAlert(options){
14+
current=Object.assign({},open,options);
15+
returncurrent;
16+
}
1317
functionalertReducer(alert,action){
1418
if(alert===void0){alert=_alert;}
1519
varstatusBarAlert=document.getElementsByClassName('cr-alert-replay')[0];
1620
switch(action.type){
1721
case_types_1.ALERT_REPLAY:
18-
returnObject.assign({},current,open);
22+
returnsetAlert(current);
1923
case_types_1.ALERT_TOGGLE:
2024
returnaction.payload.alert||_alert;
2125
case_types_1.TUTORIAL_UPDATE:
22-
current=Object.assign({},{
26+
returnsetAlert({
2327
message:"run `npm install --save-dev "+action.payload.name+"`",
2428
action:'note',
2529
duration:4000,
26-
},open);
27-
returncurrent;
30+
});
2831
case_types_1.TEST_RESULT:
2932
varresult=action.payload.result;
3033
if(result.pass&&result.change>0){
3134
statusBarAlert.style.color='#73C990';
32-
current=Object.assign({},{
35+
returnsetAlert({
3336
message:result.msg,
3437
duration:result.duration||1500,
35-
},open);
36-
returncurrent;
38+
});
3739
}
3840
elseif(result.pass===false&&result.change<1){
3941
statusBarAlert.style.color='#FF4081';
40-
current=Object.assign({},{
42+
returnsetAlert({
4143
message:result.msg,
4244
action:'fail',
4345
duration:result.duration||2500,
44-
},open);
45-
returncurrent;
46+
});
4647
}
4748
statusBarAlert.style.color='#9DA5B4';
48-
current=Object.assign({},{
49+
returnsetAlert({
4950
message:result.msg,
5051
action:'note',
5152
duration:result.duration||2500,
52-
},open);
53-
returncurrent;
53+
});
5454
case_types_1.COMPLETE_PAGE:
55-
current=Object.assign({},{
55+
returnsetAlert({
5656
message:"Page "+(action.payload.position.page+1)+" Complete",
57-
},open);
58-
returncurrent;
57+
});
5958
case_types_1.COMPLETE_CHAPTER:
60-
current=Object.assign({},{
59+
returnsetAlert({
6160
message:"Chapter "+(action.payload.chapter+1)+" Complete",
62-
},open);
63-
returncurrent;
61+
});
6462
case_types_1.COMPLETE_TUTORIAL:
65-
current=Object.assign({},{
63+
returnsetAlert({
6664
message:'Tutorial Complete',
67-
},open);
68-
returncurrent;
65+
});
6966
default:
7067
returnalert;
7168
}

‎src/components/Alert/_alert.less

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
@import"ui-variables";
22

3-
.cr-alert.pass {
3+
.cr-alert {
44
button {
5+
position:relative;
56
span {
6-
color:@background-color-success;
7+
position:absolute;
8+
top:-8px;
79
}
810
}
911
}
10-
.cr-alert.fail {
11-
button {
12-
span {
13-
color:@background-color-error;
14-
}
15-
}
12+
.cr-alert.passbuttonspan {
13+
color:@background-color-success;
1614
}
17-
.cr-alert.note {
18-
button {
19-
span {
20-
color:@background-color-info;
21-
}
22-
}
15+
.cr-alert.failbuttonspan {
16+
color:@background-color-error;
17+
}
18+
.cr-alert.notebuttonspan {
19+
color:@background-color-info;
2320
}
24-
2521
.cr-alert-replay {
2622
display:inline-block;
27-
margin-left:10px;
28-
margin-right:10px;
23+
margin:010px;
2924
}

‎src/reducers/alert/index.ts

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,68 @@ const _alert: CR.Alert = {
1111
};
1212
constopen={
1313
open:true,
14-
pass:true,
14+
action:'pass',
1515
};
1616

1717
letcurrent:CR.Alert=_alert;
1818

19+
functionsetAlert(options){
20+
current=Object.assign({},open,options);
21+
returncurrent;
22+
}
23+
1924
exportdefaultfunctionalertReducer(
2025
alert=_alert,action:Action
2126
):CR.Alert{
2227
letstatusBarAlert=<HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
2328
switch(action.type){
2429
caseALERT_REPLAY:
25-
returnObject.assign({},current,open);
30+
returnsetAlert(current);
2631
caseALERT_TOGGLE:
2732
returnaction.payload.alert||_alert;
2833
caseTUTORIAL_UPDATE:
29-
current=Object.assign({},{
34+
returnsetAlert({
3035
message:`run \`npm install --save-dev${action.payload.name}\``,
3136
action:'note',
3237
duration:4000,
33-
},open);
34-
returncurrent;
38+
});
3539
caseTEST_RESULT:
3640
letresult=action.payload.result;
3741
if(result.pass&&result.change>0){
3842
// Pass
3943
statusBarAlert.style.color='#73C990';
40-
current=Object.assign({},{
44+
returnsetAlert({
4145
message:result.msg,
4246
duration:result.duration||1500,
43-
},open);
44-
returncurrent;
47+
});
4548
}elseif(result.pass===false&&result.change<1){
4649
// Fail
4750
statusBarAlert.style.color='#FF4081';
48-
current=Object.assign({},{
51+
returnsetAlert({
4952
message:result.msg,
5053
action:'fail',
5154
duration:result.duration||2500,
52-
},open);
53-
returncurrent;
55+
});
5456
}
5557
// Alert
5658
statusBarAlert.style.color='#9DA5B4';
57-
current=Object.assign({},{
59+
returnsetAlert({
5860
message:result.msg,
5961
action:'note',
6062
duration:result.duration||2500,
61-
},open);
62-
returncurrent;
63+
});
6364
caseCOMPLETE_PAGE:
64-
current=Object.assign({},{
65+
returnsetAlert({
6566
message:`Page${action.payload.position.page+1} Complete`,
66-
},open);
67-
returncurrent;
67+
});
6868
caseCOMPLETE_CHAPTER:
69-
current=Object.assign({},{
69+
returnsetAlert({
7070
message:`Chapter${action.payload.chapter+1} Complete`,
71-
},open);
72-
returncurrent;
71+
});
7372
caseCOMPLETE_TUTORIAL:
74-
current=Object.assign({},{
73+
returnsetAlert({
7574
message:'Tutorial Complete',
76-
},open);
77-
returncurrent;
75+
});
7876
default:
7977
returnalert;
8078
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp