-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.html
More file actions
248 lines (227 loc) · 7.78 KB
/
example.html
File metadata and controls
248 lines (227 loc) · 7.78 KB
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
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta viewport="width=device-width, initial-scale=1.0" />
<title>MCSS Workshop</title>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
<div id="root">
</div>
<script type="text/babel">
function Accordion({ header, children }) {
return (
<div className="accordion">
<div className="accordion-header">
<div>🞃</div>
<h3>{header}</h3>
</div>
<div>{children}</div>
</div>
);
}
function CourseAddForm() {
return (
<div>
<h2>Add a course</h2>
<form id="course-addition" onSubmit={e => e.preventDefault()}>
<label htmlFor="course">Name</label>
<input type="text" id="course" name="course" />
<label htmlFor="description">Description</label>
<textarea id="description" name="description"></textarea>
<input type="submit" value="Submit" />
</form>
</div>
);
}
function Courses() {
const [courses, setCourses] = React.useState(() =>
JSON.parse(document.getElementById('hidden-content').textContent).courses);
return (
<div>
<h2>Courses</h2>
{Object.keys(courses).map((course, i) => (
<Accordion key={i} header={course}>
<p>{courses[course].description}</p>
<p>Prerequisites: {courses[course].prerequisites.join(', ')}</p>
</Accordion>
))}
<CourseAddForm onCourseAdd={(name, description) =>
setCourses({[name]: { description, prerequisites: [] }, ...courses})} />
</div>
);
}
function Clubs() {
return (
<div>
<h2>Clubs</h2>
<div className="club-container">
<a className="club" href="#">
<img src="https://www.utm.utoronto.ca/math-cs-stats/sites/files/math-cs-stats/styles/full_width_xl/public/shared/CSSC.png.webp?itok=yB4NBAuR" />
</a>
<a className="club" href="#">
<img src="https://www.utm.utoronto.ca/math-cs-stats/sites/files/math-cs-stats/styles/full_width_xl/public/shared/MCSS.png.webp?itok=V_V7ou1F" />
</a>
<a className="club" href="#">
<img src="https://www.utm.utoronto.ca/math-cs-stats/sites/files/math-cs-stats/styles/full_width_xl/public/shared/UTMSAM.png.webp?itok=UbzrFKCM" />
</a>
<a className="club" href="#">
<img src="https://www.utm.utoronto.ca/math-cs-stats/sites/files/math-cs-stats/styles/full_width_xl/public/shared/UTM%20Robotiocs.png.webp?itok=zAekJkWy" />
</a>
<a className="club" href="#">
<img src="https://www.utm.utoronto.ca/math-cs-stats/sites/files/math-cs-stats/styles/full_width_xl/public/shared/wISC.png.webp?itok=fCnaicso" />
</a>
</div>
</div>
);
}
function People() {
return (
<div>
<h2>People</h2>
<ul>
<li>Michael Liut</li>
<li>Arnold Rosenbloom</li>
<li>Andi Bergen</li>
</ul>
</div>
);
}
function Website() {
return (
<div>
<header>
<h1>MCSS React Workshop</h1>
</header>
<nav>
<ul>
<li><a>Courses</a></li>
<li><a>Clubs</a></li>
<li><a>People</a></li>
</ul>
</nav>
<main>
<Courses />
<Clubs />
<People />
</main>
</div>
);
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Website />);
</script>
<style>
body {
margin: 0;
}
header {
width: 100%;
padding: 30pt;
box-sizing: border-box;
background-color: lightblue;
}
header h1 {
margin: 0;
color: crimson;
}
nav {
padding: 5pt 50pt;
box-sizing: border-box;
}
nav ul {
display: flex;
flex-direction: row;
gap: 10pt;
align-items: center;
list-style: none;
}
nav ul li a {
text-decoration: none;
color: black;
cursor: pointer;
font-size: 20pt;
}
main {
padding: 0pt 60pt 50pt 60pt;
box-sizing: border-box;
}
.accordion {
border-radius: 5pt;
border: 1pt solid black;
margin: 10pt 0;
padding: 5pt;
box-sizing: border-box;
}
.accordion-header {
display: flex;
flex-direction: row;
align-items: center;
cursor: pointer;
gap: 5pt;
}
.accordion-header div {
position: relative;
font-weight: 900;
font-size: 20pt;
top: -10pt;
width: 15pt;
height: 15pt;
}
#course-addition {
display: flex;
flex-direction: column;
gap: 10pt;
margin: 10pt 0;
width: 300px;
}
.club-container {
display: flex;
flex-wrap: wrap;
gap: 10pt;
}
.club {
position: relative;
top: 0px;
display: flex;
justify-content: center;
align-items: center;
width: 220px;
height: 220px;
overflow: hidden;
border-radius: 5pt;
border: 2pt solid gray;
transition: 200ms;
}
.club:hover {
top: -5px;
box-shadow: 2px 8px 2px orange;
}
.club img {
max-width: 200px;
max-height: 200px;
}
</style>
<div style="visibility: hidden;" id="hidden-content">
{
"courses": {
"CSC108H5": {
"description": "This course introduces students to the principles of computer programming and to the basic techniques for writing programs using a high-level programming language. It also introduces students to the design and analysis of algorithms, the structure of computer systems, and the nature of computer science.",
"prerequisites": []
},
"CSC148H5": {
"description": "This course introduces students to the principles of computer programming and to the basic techniques for writing programs using a high-level programming language. It also introduces students to the design and analysis of algorithms, the structure of computer systems, and the nature of computer science.",
"prerequisites": ["CSC108H5"]
},
"CSC207H5": {
"description": "CSC207H5 is a course that focuses on software development and introduces students to Java and the Software Development Life Cycle (SDLC). In this course, students will learn the fundamentals of Java programming, including object-oriented programming concepts and techniques. They will also gain an understanding of the SDLC, which encompasses the processes and methodologies used in developing software applications. Through hands-on projects and assignments, students will have the opportunity to apply their knowledge and develop real-world software solutions. By the end of the course, students will have a solid foundation in Java programming and a comprehensive understanding of the software development process.",
"prerequisites": ["CSC148H5"]
}
}
}
</div>
</body>
</html>