File tree Expand file tree Collapse file tree 9 files changed +105
-73
lines changed Expand file tree Collapse file tree 9 files changed +105
-73
lines changed Original file line number Diff line number Diff line change 5
5
font-family : Arial, Helvetica, sans-serif;
6
6
margin : 0 ;
7
7
padding : 0 ;
8
+ color : # 333 ;
9
+ }
10
+
11
+ html {
12
+ background-color : # ecf5ff ;
8
13
}
9
14
10
15
/* TEXT */
15
20
margin-bottom : 10px ;
16
21
}
17
22
23
+ h1 {
24
+ font-size : 54px ;
25
+ color : # 56a5eb ;
26
+ margin-bottom : 50px ;
27
+ }
28
+
29
+ h1 > span {
30
+ font-size : 24px ;
31
+ font-weight : 500 ;
32
+ }
33
+
34
+ h2 {
35
+ font-size : 42px ;
36
+ margin-bottom : 40px ;
37
+ font-weight : 500 ;
38
+ }
39
+
40
+ h3 {
41
+ font-size : 28px ;
42
+ font-weight : 500 ;
43
+ }
44
+
45
+ .text-xl {
46
+ font-size : 100px ;
47
+ }
48
+
18
49
/* Utilities */
19
50
20
51
.container {
21
52
width : 100vw ;
22
53
height : 100vh ;
23
54
display : flex;
55
+ padding : 20px ;
24
56
justify-content : center;
25
57
align-items : center;
26
58
margin : 0 auto;
62
94
63
95
form {
64
96
width : 100% ;
97
+ display : flex;
98
+ align-items : center;
99
+ flex-direction : column;
65
100
}
66
101
67
- label ,
68
102
input {
103
+ margin-bottom : 10px ;
69
104
display : block;
70
- width : 100% ;
105
+ width : 200px ;
106
+ padding : 15px ;
107
+ font-size : 18px ;
108
+ border : none;
109
+ box-shadow : 0 1px 14px 0 rgba (86 , 185 , 235 , 0.5 );
71
110
}
72
111
73
- label {
74
- margin-bottom : 5px ;
75
- }
76
- input ,
77
- select {
78
- margin-bottom : 10px ;
79
- height : 40px ;
112
+ input ::placeholder {
113
+ color : # aaa ;
80
114
}
81
115
select {
82
116
display : block;
83
117
}
84
118
.btn {
85
- font-size : 16 px ;
119
+ font-size : 18 px ;
86
120
padding : 10px 0 ;
87
121
width : 200px ;
88
122
text-align : center;
89
- border : 1px solid black ;
123
+ border : 1px solid # 56a5eb ;
90
124
margin-bottom : 10px ;
91
125
text-decoration : none;
92
- color : black;
126
+ color : # 56a5eb ;
127
+ background-color : white;
93
128
}
94
129
95
130
.btn : hover {
96
131
cursor : pointer;
97
- box-shadow : 0 4px 14px 0 rgba (0 , 0 , 0 , 0.15 );
98
- transform : translateY (-2 px );
132
+ box-shadow : 0 4px 14px 0 rgba (86 , 185 , 235 , 0.5 );
133
+ transform : translateY (-1 px );
99
134
transition : -webkit-transform 150ms ;
100
135
transition : transform 150ms ;
101
136
transition : transform 150ms , -webkit-transform 150ms ;
102
137
}
103
138
104
- .btn [disabled ] {
105
- color : white;
106
- background : grey;
107
- border : none;
108
- }
109
-
110
139
.btn [disabled ]: hover {
111
140
cursor : not-allowed;
112
141
box-shadow : none;
Original file line number Diff line number Diff line change 11
11
< body >
12
12
< div class ="container ">
13
13
< div id ="end " class ="flex-center flex-column ">
14
- < h1 class ="text-center "> Great Job!</ h1 >
15
- < h2 id ="finalScore "> 100</ h2 >
16
- < a class ="btn " href ="/ "> Go Home</ a >
14
+ < h1 class ="text-xl " id ="finalScore "> </ h1 >
17
15
< form >
18
- < label for ="username "> Username</ label >
19
- < input type ="text " name ="username " id ="username " />
16
+ <!-- <label for="username">Username</label> -->
17
+ < input
18
+ type ="text "
19
+ name ="username "
20
+ id ="username "
21
+ placeholder ="username "
22
+ />
20
23
< button
21
24
class ="btn "
22
25
type ="submit "
@@ -27,6 +30,7 @@ <h2 id="finalScore">100</h2>
27
30
Save
28
31
</ button >
29
32
</ form >
33
+ < a class ="btn " href ="/ "> Go Home</ a >
30
34
</ div >
31
35
</ div >
32
36
< script src ="end.js "> </ script >
Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ const highScores = JSON.parse(localStorage.getItem("highScores")) || [];
5
5
const mostRecentScore = localStorage . getItem ( "mostRecentScore" ) ;
6
6
//load mostRecentScore from localStorage
7
7
//TODO: navigate home if no previous score
8
- finalScore . innerText = localStorage . getItem ( "mostRecentScore" ) ;
8
+ finalScore . innerHTML = `${ localStorage . getItem (
9
+ "mostRecentScore"
10
+ ) } <span>pts</span>`;
9
11
10
12
saveHighScore = e => {
11
13
console . log ( "save high score" ) ;
12
14
e . preventDefault ( ) ;
13
15
//add the score, sort the array, and splice off starting at position 5
14
- highScores . push ( { mostRecentScore, username : usernameInput . value } ) ;
16
+ highScores . push ( { score : mostRecentScore , username : usernameInput . value } ) ;
15
17
highScores . sort ( ( a , b ) => b . score - a . score ) ;
16
18
highScores . splice ( 5 ) ;
17
19
//Save to local storage for next time
Original file line number Diff line number Diff line change 2
2
.choice-container {
3
3
display : flex;
4
4
margin-bottom : 5px ;
5
- width : 100% !important ;
5
+ width : 100% ;
6
+ font-size : 18px ;
7
+ border : 1px solid # 56a5eb ;
8
+ margin-bottom : 10px ;
9
+ color : # 56a5eb ;
10
+ background-color : white;
11
+ }
12
+
13
+ .choice-container : hover {
14
+ cursor : pointer;
15
+ box-shadow : 0 4px 14px 0 rgba (86 , 185 , 235 , 0.5 );
16
+ transform : translateY (-1px );
17
+ transition : transform 150ms ;
18
+ transition : transform 150ms , -webkit-transform 150ms ;
6
19
}
7
20
8
21
.choice-prefix {
9
- padding : 5px 0 ;
10
- width : 50px ;
11
- text-align : center;
12
- border-right : 1px solid black;
22
+ padding : 15px 25px ;
23
+ background-color : # 56a5eb ;
24
+ color : white;
13
25
}
14
26
15
- .choice {
16
- padding : 5 px 0 ;
27
+ .choice-text {
28
+ padding : 15 px ;
17
29
flex-grow : 1 ;
30
+ color : black;
18
31
}
19
32
20
33
.correct {
28
41
# hud {
29
42
display : flex;
30
43
justify-content : space-between;
44
+ margin-bottom : 15px ;
31
45
}
32
46
33
47
@keyframes correct {
Original file line number Diff line number Diff line change 12
12
< body >
13
13
< div class ="container ">
14
14
< div id ="game " class ="justify-center flex-column ">
15
- < a class ="btn " href ="/ "> Go Home</ a >
15
+ <!-- < a class="btn" href="/">Go Home</a> -- >
16
16
17
17
< div id ="hud ">
18
- < h3 id ="questionCounter "> Question 1/5</ h3 >
18
+ < h3 id ="questionCounter "> 1/5</ h3 >
19
19
< h3 id ="score "> Score: 0</ h3 >
20
20
</ div >
21
21
< h2 id ="question "> </ h2 >
22
- < div class ="choice-container btn ">
22
+ < div class ="choice-container ">
23
23
< p class ="choice-prefix "> A</ p >
24
- < p class ="choice " data-number ="1 "> </ p >
24
+ < p class ="choice-text " data-number ="1 "> </ p >
25
25
</ div >
26
- < div class ="choice-container btn ">
26
+ < div class ="choice-container ">
27
27
< p class ="choice-prefix "> B</ p >
28
- < p class ="choice " data-number ="2 "> </ p >
28
+ < p class ="choice-text " data-number ="2 "> </ p >
29
29
</ div >
30
- < div class ="choice-container btn ">
30
+ < div class ="choice-container ">
31
31
< p class ="choice-prefix "> C</ p >
32
- < p class ="choice " data-number ="3 "> </ p >
32
+ < p class ="choice-text " data-number ="3 "> </ p >
33
33
</ div >
34
- < div class ="choice-container btn ">
34
+ < div class ="choice-container ">
35
35
< p class ="choice-prefix "> D</ p >
36
- < p class ="choice " data-number ="4 "> </ p >
36
+ < p class ="choice-text " data-number ="4 "> </ p >
37
37
</ div >
38
38
</ div >
39
39
</ div >
Original file line number Diff line number Diff line change 1
1
//GAME Elements
2
2
const question = document . getElementById ( "question" ) ;
3
- const choices = Array . from ( document . getElementsByClassName ( "choice" ) ) ;
3
+ const choices = Array . from ( document . getElementsByClassName ( "choice-text " ) ) ;
4
4
const scoreText = document . getElementById ( "score" ) ;
5
5
const questionCounterText = document . getElementById ( "questionCounter" ) ;
6
6
@@ -62,6 +62,7 @@ getNewQuestion = () => {
62
62
63
63
choices . forEach ( choice => {
64
64
const number = choice . dataset [ "number" ] ;
65
+ console . log ( "setting choice" ) ;
65
66
choice . innerHTML = currentQuestion [ "choice" + number ] ;
66
67
} ) ;
67
68
Original file line number Diff line number Diff line change 3
3
# highScoresList {
4
4
padding-left : 0 ;
5
5
list-style : none;
6
+ margin-bottom : 40px ;
7
+ }
8
+
9
+ .high-score {
10
+ font-size : 28px ;
11
+ margin-bottom : 5px ;
12
+ }
13
+
14
+ .high-score : hover {
15
+ transform : scale (1.05 );
6
16
}
Original file line number Diff line number Diff line change 1
1
const highScoresList = document . getElementById ( "highScoresList" ) ;
2
2
const highScores = JSON . parse ( localStorage . getItem ( "highScores" ) ) || [ ] ;
3
- console . log ( highScores ) ;
4
3
highScoresList . innerHTML = highScores
5
4
. map (
6
5
highScore =>
Original file line number Diff line number Diff line change @@ -18,30 +18,3 @@ <h1>Quick Quiz</h1>
18
18
< script src ="app.js "> </ script >
19
19
</ body >
20
20
</ html >
21
-
22
- <!-- <button class="btn" onclick="navigateTo('submitQuestion')">Submit Question</button> -->
23
-
24
- <!-- <div id="submitQuestion" class=" flex-center flex-column">
25
- <button class="btn" onClick="navigateTo('home')">Go Home</button>
26
- <h2 class="text-center">Submit a new question!</h2>
27
- <form>
28
- <label for="question">Question</label>
29
- <input type="text" name="question" id="questionInput" />
30
- <label for="choice1">Answer Choice 1</label>
31
- <input type="text" name="choice1" id="choice1" />
32
- <label for="choice2">Answer Choice 2</label>
33
- <input type="text" name="choice2" id="choice2" />
34
- <label for="choice3">Answer Choice 3</label>
35
- <input type="text" name="choice3" id="choice3" />
36
- <label for="choice4">Answer Choice 4</label>
37
- <input type="text" name="choice4" id="choice" />
38
- <label for="correctAnswer">Correct Answer</label>
39
- <select>
40
- <option value="1">1</option>
41
- <option value="1">2</option>
42
- <option value="1">3</option>
43
- <option value="1">4</option>
44
- </select>
45
- <button class="btn" type="submit" id="submitScoreBtn">Submit</button>
46
- </form>
47
- </div> -->
You can’t perform that action at this time.
0 commit comments