-
Notifications
You must be signed in to change notification settings - Fork 0
/
Badge_page.html
236 lines (201 loc) · 6 KB
/
Badge_page.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>Badges Page</title>
<style>
/* Colour Themes */
/* Light Theme */
:root, .light-mode {
--primary-color: #f5ffe6;; /* Default primary color */
--secondary-color: #cfedcf; /* Default secondary color */
}
/* Dark Theme */
.dark-mode {
--primary-color: #454a50;
--secondary-color: #adb5bd;
color: #f0f0f0;
}
/* High Contrast Theme */
.high-contrast-mode {
--primary-color: #9aff9a;;
--secondary-color: #2fed2f;
color: #535353;
}
/* Logo */
header img {
width: 100px;
height: 100px;
position: absolute;
top: 10px;
left: 10px;
}
/* Creates the formatting for which the badges are spaced apart */
.column {
float: left;
width: 33.33%;
padding: 5px;
}
.row::after{
content: "";
clear: both;
display: table;
}
/* colours the background */
html {
background-color: var(--secondary-color);
}
/* Removes the space between items and the border, and sets the style for the text. */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 100;
}
/* creates a banner that looks in line with the theme */
header {
background-color: var(--primary-color);
color: white;
padding: 20px 40px;
width: 100%;
position: fixed;
text-align: center;
font-weight:bold;
justify-content: space-between;
margin-top: 0px;
top: 0px;
}
/* indents the badges as so that they arent hugging the border */
.badges {
margin: 150px auto 50px;
width: 80%;
}
/* indents the text as so that they aren't hugging the wall */
h2{
margin-left: 10px;
margin-top: 50px;
}
/* sizes the image used within the home button as so that it is the correct size. */
.homeButtonImg{
width: 80px;
height: 80px;;
}
/* Color Theme Buttons */
.setTheme {
position: fixed;
top: 10px;
right: 30px;
z-index: 9999;
}
.setTheme button {
padding: 5px 10px;
background-color: var(--secondary-color);
color: #fff;
border: none;
border-radius: 30px;
cursor: pointer;
font-size: 18px;
transition: all 0.3s ease;
}
.setTheme button:hover {
background-color: #5e5e5e;
}
.setTheme button:active {
transform: translateY(2px);
}
.home {
padding: 10px 20px;
background-color:#FFFFFF;
color: #000000;
border: none;
border-radius: 30px;
cursor: pointer;
font-size: 18px;
transition: all 0.3s ease;
right: 20px;
}
.home:hover {
background-color: #5e5e5e;
}
.home:active {
transform: translateY(2px);
}
</style>
</head>
<body>
<header>
<img src="logo.png" alt="Willowbank" style="width: 80px; height: 80px; left; margin-right: 10px;">
<h2 style="color: darkgreen;">Willowbank Education: Fishing and Forest School</h2>
<!-- Colour themes for page -->
<div class="setTheme">
<button onclick="setTheme('light-mode')">Light Mode</button>
<button onclick="setTheme('high-contrast-mode')">High Contrast Mode</button>
<button onclick="setTheme('dark-mode')">Dark Mode</button>
<!-- Home button -->
<button class="home" id="homeIcon">Home <i class="material-icons">home</i></button>
</div>
</header>
<h2 style="color: #6b4a0f;" >Badges </h2>
<div class="badges">
<script>
/*Theme Colour */
function setTheme(theme) {
document.documentElement.className = theme;
}
const current = 1;
/*dummy data*/
var names = ["Badge1", "Badge2", "Badge3", "Badge4", "Badge5"];
var dates = ["01/08/2004","05/10/1980","07/12/2011","27/08/2011","20/02/1974"];
var imgs = [["20240301_204629000_iOS.jpg"],["20240229_213332000_iOS.jpg"],["cooking.png"],["archery badge.png"],["20240229_213332000_iOS.jpg"]]
/*creates the template of the form the badges will be in.*/
function templateCreation()
{
var templates = [];
var eye = (current*4)-4;
//creates the begining of the division that will be used to format the
templates.push('<div class="row">');
for(let i = eye; i < eye+4; i++)
{
if(names.length >= eye)
{//the format of the output of the badges
templates.push('<div class="column"> <h4>'+names[i]+'</h4><img src="'+imgs[i]+'" alt="Badge_Img" width="200" height="200"><p>'+dates[i]+'</p> </div>');
}
else
{
break;
}
}
//ends the division created.
templates.push('</div>');
return templates;
}
/*outputs the template. This may need to be called multiple times*/
function output()
{
var array = templateCreation();
for(let i = 0; i < 6; i++)
{
document.write('<div class="individualBadge">');
document.write(array[i]);
document.write('</div>')
}
}
function increase(num)
{
current+=num;
if(current == 1)
{
document.getElementById("BackButton").disabled
}
output();
}
output(0);
document.getElementById("homeIcon").addEventListener("click", function() {
// Redirect to the home page
window.location.href = "WEchildmainpage.html";
});
</script>
</div>
<footer></footer>
</body>
</html>