Skip to content

Commit 612b2ed

Browse files
authored
Merge pull request #105 from code-dot-org/use-react-for-ui
Simplified UI in React
2 parents de867ad + 40432f0 commit 612b2ed

22 files changed

+490
-1352
lines changed

public/images/ai-bot-closed.png

2.71 KB
Loading

public/index.html

Lines changed: 12 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<title>ML Activities Playground</title>
7-
<link
8-
rel="stylesheet"
9-
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
10-
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
11-
crossorigin="anonymous"
12-
/>
137
<style>
148
#container {
159
position: relative;
@@ -18,51 +12,29 @@
1812
margin: 0 auto;
1913
user-select: none;
2014
}
21-
#header-container,
22-
#footer-container {
15+
#container-react {
16+
position: absolute;
2317
width: 100%;
24-
height: 50px;
25-
display: flex;
26-
}
27-
#header-container {
28-
align-items: center;
29-
justify-content: center;
30-
}
31-
#footer-container {
32-
justify-content: space-between;
33-
}
34-
#header {
35-
border: 2px solid black;
36-
border-radius: 20px;
37-
padding: 10px 45px;
38-
}
39-
#activity-canvas,
40-
#background-canvas {
41-
border: 2px solid black;
42-
border-radius: 5px;
18+
max-width: 970px;
19+
margin: 0 auto;
20+
user-select: none;
21+
font-family: arial, sans-serif;
22+
font-size: 18px;
23+
color: rgb(30,30,30);
4324
}
4425
#background-canvas {
4526
position: absolute;
46-
top: 50px; /* accounts for #header-container */
4727
left: 0;
4828
width: 100%;
4929
z-index: -1;
30+
border-radius: 10px;
5031
}
5132
#activity-canvas {
5233
width: 100%;
53-
}
54-
#ui-container {
55-
position: absolute;
56-
top: 50px; /* accounts for #header-container */
57-
left: 0;
58-
width: 100%;
59-
height: calc(
60-
100% - 104px
61-
); /* 50px header + 50px footer + 4px border = 104px */
34+
border-radius: 10px;
6235
}
6336
button {
64-
background-color: #403f3f; /* #4e4e82; */
65-
color: white;
37+
background-color: white;
6638
font-size: 120%;
6739
border-radius: 5px;
6840
padding: 1%;
@@ -72,31 +44,6 @@
7244
button:focus {
7345
outline: white auto 5px;
7446
}
75-
.ui-button {
76-
position: absolute;
77-
}
78-
.ui-button-1-col {
79-
width: 20%;
80-
display: block;
81-
margin: 0 auto;
82-
margin-top: 2%;
83-
margin-bottom: 2%;
84-
}
85-
.ui-button-3-col {
86-
width: 20%;
87-
margin-left: 6%;
88-
margin-right: 6%;
89-
margin-top: 2%;
90-
margin-bottom: 2%;
91-
}
92-
#activity-intro-text {
93-
position: absolute;
94-
font-size: 24px;
95-
top: 5%;
96-
width: 98%;
97-
left: 1%;
98-
text-align: center;
99-
}
10047
@media screen and (max-width: 800px) {
10148
button {
10249
font-size: 90%;
@@ -110,129 +57,13 @@
11057
font-size: 60%;
11158
}
11259
}
113-
#yes-button {
114-
border: 2px solid black;
115-
background-color: #56c568;
116-
right: 30%;
117-
bottom: 5%;
118-
}
119-
#no-button {
120-
border: 2px solid black;
121-
background-color: #e83a4d;
122-
right: 50%;
123-
bottom: 5%;
124-
}
125-
#words-text {
126-
text-align: center;
127-
margin-top: 20px;
128-
font-size: 24px;
129-
}
130-
#train-text {
131-
text-align: center;
132-
font-size: 24px;
133-
margin-top: 5%;
134-
}
135-
#training-intro-text {
136-
position: absolute;
137-
font-size: 24px;
138-
top: 20%;
139-
width: 100%;
140-
text-align: center;
141-
}
142-
#activity-intro-ai-bot,
143-
#training-intro-ai-bot,
144-
#training-ai-bot,
145-
#predict-ai-bot,
146-
#pond-ai-bot {
147-
position: absolute;
148-
height: 50%;
149-
transform: translateX(-50%);
150-
top: 50%;
151-
left: 50%;
152-
}
153-
#training-intro-ai-bot {
154-
top: 30%;
155-
}
156-
#training-ai-bot {
157-
top: 20%;
158-
left: 83%;
159-
}
160-
#predict-ai-bot {
161-
top: -6%;
162-
}
163-
#pond-ai-bot {
164-
left: 12%;
165-
}
166-
.continue-end {
167-
margin-left: auto;
168-
}
169-
#predict-button {
170-
right: 40%;
171-
bottom: 3%;
172-
}
173-
#predict-text {
174-
width: 100%;
175-
text-align: center;
176-
}
177-
#train-counter-yes-text {
178-
position: absolute;
179-
top: 0px;
180-
right: 3%;
181-
font-size: 24px;
182-
color: green;
183-
}
184-
#train-counter-no-text {
185-
position: absolute;
186-
top: 0px;
187-
right: 10%;
188-
font-size: 24px;
189-
color: red;
190-
}
191-
.show-code-toggle {
192-
position: absolute;
193-
top: 5px;
194-
left: 0px;
195-
}
196-
#code {
197-
background-color: #c3c3c3;
198-
position: absolute;
199-
top: 60px;
200-
left: 20px;
201-
opacity: 0.8;
202-
width: 40%;
203-
height: 60%;
204-
border-radius: 10px;
205-
display: none;
206-
}
207-
#code-blocks-image {
208-
margin-left: 20px;
209-
margin-top: 20px;
210-
border-radius: 5px;
211-
}
212-
#pond-text {
213-
position: absolute;
214-
top: 71%;
215-
left: 27%;
216-
max-width: 50%;
217-
font-weight: bold;
218-
text-align: center;
219-
padding: 0 20px 20px 20px;
220-
color: white;
221-
background-color: rgba(64, 63, 63, 0.8);
222-
border-radius: 5px;
223-
}
22460
</style>
22561
</head>
22662
<body>
22763
<div id="container">
228-
<div id="header-container"></div>
64+
<div id="container-react"></div>
22965
<canvas id="background-canvas"></canvas>
23066
<canvas id="activity-canvas"></canvas>
231-
<div id="ui-container"></div>
232-
<div id="footer-container"></div>
233-
<div id="code">
234-
<img id="code-blocks-image" src="images/code-blocks-predict.png" />
235-
</div>
23667
</div>
23768
<script src="demo.js"></script>
23869
</body>

src/MLActivities.jsx

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/activities/imageRecognition/Draggable.jsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/activities/imageRecognition/Droppable.jsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)