File tree Expand file tree Collapse file tree 8 files changed +611
-95
lines changed Expand file tree Collapse file tree 8 files changed +611
-95
lines changed Original file line number Diff line number Diff line change 8
8
"lint" : " vue-cli-service lint"
9
9
},
10
10
"dependencies" : {
11
+ "boxicons" : " ^2.1.2" ,
11
12
"core-js" : " ^3.8.3" ,
12
13
"vue" : " ^3.2.13"
13
14
},
Original file line number Diff line number Diff line change 5
5
< meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
6
< meta name ="viewport " content ="width=device-width,initial-scale=1.0 ">
7
7
< link rel ="icon " href ="<%= BASE_URL %>favicon.ico ">
8
- < title > < %= htmlWebpackPlugin.options.title % > </ title >
8
+ < title > Test Reaksi </ title >
9
9
</ head >
10
10
< body >
11
11
< noscript >
12
- < strong > We're sorry but < %= htmlWebpackPlugin.options.title % > doesn't work properly without JavaScript enabled. Please enable it to continue .</ strong >
12
+ < strong color =" #000 " > Sorry, Brodi! Test Reaksi gak bisa jalan kalo javascript lu dimatiin atau device lu gak support javascript. Nyalain javascript biar bisa jalan .</ strong >
13
13
</ noscript >
14
14
< div id ="app "> </ div >
15
15
<!-- built files will be auto injected -->
Original file line number Diff line number Diff line change 1
1
<template >
2
- <img alt =" Vue logo" src =" ./assets/logo.png" >
3
- <HelloWorld msg =" Welcome to Your Vue.js App" />
2
+ <h1 >Seberapa Cepet Reflek Lu!</h1 >
3
+
4
+ <button @click =" start" :disabled =" mulai" >
5
+ <box-icon name =" play" color =" #fff" />
6
+ <p >Mulai</p >
7
+ </button >
8
+ <Main v-if =" mulai" :delay =" delay" @selesai =" gameSelesai" />
9
+ <Hasil v-if =" tampilkanHasil" :score =" hasilScore" />
4
10
</template >
5
11
6
12
<script >
7
- import HelloWorld from ' ./components/HelloWorld.vue'
13
+ import Main from " ./components/Main.vue" ;
14
+ import Hasil from " ./components/Hasil.vue" ;
8
15
9
16
export default {
10
- name: ' App' ,
17
+ name: " App" ,
11
18
components: {
12
- HelloWorld
13
- }
14
- }
19
+ Main,
20
+ Hasil,
21
+ },
22
+ data () {
23
+ return {
24
+ mulai: false ,
25
+ delay: null ,
26
+ hasilScore: null ,
27
+ tampilkanHasil: false ,
28
+ };
29
+ },
30
+ methods: {
31
+ start () {
32
+ this .delay = 2000 + Math .random () * 8000 ;
33
+ this .mulai = true ;
34
+ this .tampilkanHasil = false ;
35
+ },
36
+ gameSelesai (e ) {
37
+ this .hasilScore = e;
38
+ this .mulai = false ;
39
+ this .tampilkanHasil = true ;
40
+ },
41
+ },
42
+ };
15
43
</script >
16
44
17
45
<style >
@@ -20,7 +48,26 @@ export default {
20
48
-webkit-font-smoothing : antialiased ;
21
49
-moz-osx-font-smoothing : grayscale ;
22
50
text-align : center ;
23
- color : #2c3e50 ;
51
+ color : #444 ;
24
52
margin-top : 60px ;
25
53
}
54
+ button {
55
+ display : flex ;
56
+ align-items : center ;
57
+ justify-content : center ;
58
+ margin : auto ;
59
+ background : #0faf87 ;
60
+ border-radius : 5px ;
61
+ padding : 0.2rem 0.8rem ;
62
+ color : white ;
63
+ border : none ;
64
+ outline : none ;
65
+ cursor : pointer ;
66
+ }
67
+ button [disabled ] {
68
+ opacity : 0.2 ;
69
+ }
70
+ button p {
71
+ margin-left : 0.2rem ;
72
+ }
26
73
</style >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <p >Reaksi kamu : {{ score }} ms</p >
3
+ <p class =" rank" >{{ rank }}</p >
4
+ </template >
5
+
6
+ <script >
7
+ export default {
8
+ name: " HasilComp" ,
9
+ props: [" score" ],
10
+ data () {
11
+ return {
12
+ rank: null ,
13
+ };
14
+ },
15
+ mounted () {
16
+ if (this .score < 50 ) {
17
+ this .rank = " Buset serius bukan Robot!!?" ;
18
+ } else if (this .score < 100 ) {
19
+ this .rank = " Mantap, Nice Flick" ;
20
+ } else if (this .score < 200 ) {
21
+ this .rank = " Oke standar lah.." ;
22
+ } else if (this .score < 300 ) {
23
+ this .rank = " Oalah, Konsen lah!" ;
24
+ } else if (this .score >= 300 && this .rank <= 500 ) {
25
+ this .rank = " Serius!!? Mending main pou dah.. " ;
26
+ } else if (this .rank > 500 ) {
27
+ this .rank = " Lag kali otakmu dek!" ;
28
+ }
29
+ },
30
+ };
31
+ </script >
32
+
33
+ <style >
34
+ .rank {
35
+ font-size : 1.4em ;
36
+ color : #0faf87 ;
37
+ font-weight : bold ;
38
+ }
39
+ </style >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" main" v-if =" tampilkan" @click =" stopTimer" >Klik Disini!</div >
3
+ </template >
4
+
5
+ <script >
6
+ export default {
7
+ name: " MainComp" ,
8
+ props: [" delay" ],
9
+ data () {
10
+ return {
11
+ tampilkan: false ,
12
+ timer: null ,
13
+ waktuReflek: 0 ,
14
+ tampilkanHasil: false ,
15
+ };
16
+ },
17
+ mounted () {
18
+ setTimeout (() => {
19
+ this .tampilkan = true ;
20
+ this .mulaiTimer ();
21
+ }, this .delay );
22
+ },
23
+ methods: {
24
+ mulaiTimer () {
25
+ this .timer = setInterval (() => {
26
+ this .waktuReflek += 1 ;
27
+ }, 1 );
28
+ },
29
+ stopTimer () {
30
+ clearInterval (this .timer );
31
+ this .$emit (" selesai" , this .waktuReflek );
32
+ },
33
+ },
34
+ };
35
+ </script >
36
+
37
+ <style >
38
+ .main {
39
+ width : 400px ;
40
+ border-radius : 20px ;
41
+ background : #0cc798 ;
42
+ color : white ;
43
+ text-align : center ;
44
+ padding : 100px 0 ;
45
+ margin : 40px auto ;
46
+ }
47
+ </style >
Original file line number Diff line number Diff line change 1
1
import { createApp } from 'vue'
2
2
import App from './App.vue'
3
+ import 'boxicons'
3
4
4
5
createApp ( App ) . mount ( '#app' )
You can’t perform that action at this time.
0 commit comments