Skip to content

Commit cd57f80

Browse files
committed
Include styles for small screens
1 parent addb661 commit cd57f80

File tree

3 files changed

+106
-3
lines changed

3 files changed

+106
-3
lines changed

learn/templates/learn/kmeans.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ <h2 class="chapter-subheading">Choosing the Number of Clusters (\( K \))</h2>
8484
</li>
8585
</ul>
8686
</div>
87-
<div class="img-div">
87+
<div class="img-div no-of-clusters">
8888
<img src="{% static 'learn/img/elbow_method_kmeans.png' %}" alt="Elbow Method" style="width:300px;">
8989
<span class="caption">Elbow Method for Choosing \( K \)</span>
9090
</div>

learn/templates/learn/layout.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load static %}
1+
{% load static %}
22
<!DOCTYPE html>
33
<html lang="en">
44
<head>
@@ -58,7 +58,11 @@ <h1 class="display-4"><img src="{% static 'main/img/es_logo_transparent.png' %}"
5858
</nav>
5959

6060
<div class="learn-container d-flex">
61-
<div class="left chapters">
61+
<div class="left chapters open">
62+
<div class="chapter-links-header">
63+
<button class="btn btn-sm toggle-chapter-links" id="chapter-link-close" onClick="toggleChapterLinks()">&lt;</button>
64+
<button class="btn btn-sm d-none toggle-chapter-links" id="chapter-link-open" onClick="toggleChapterLinks()">&gt;</button>
65+
</div>
6266
<div class="links">
6367
{% for chapter in chapters %}
6468
<a href="{% url 'chapter' chapter %}" class="chapter-link-a"><div class="chapter-link">{{ chapter.title | title }}</div></a>
@@ -155,6 +159,14 @@ <h5>Preprocessing</h5>
155159
});
156160
// Syntax highlighting
157161
Prism.highlightAll();
162+
// Toggle chapter links
163+
function toggleChapterLinks() {
164+
const chapters = document.querySelector('.chapters .links');
165+
chapters.classList.toggle('d-none');
166+
document.querySelector('.chapters').classList.toggle('open');
167+
document.getElementById('chapter-link-close').classList.toggle('d-none');
168+
document.getElementById('chapter-link-open').classList.toggle('d-none');
169+
}
158170
</script>
159171
{% block script %}{% endblock %}
160172
</body>

main/static/learn/css/style.css

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,94 @@ table.confusion-matrix td.correct {
122122
table.confusion-matrix td.incorrect {
123123
background-color: rgba(255, 0, 0, 0.1);
124124
}
125+
126+
.chapter-links-header {
127+
display: none;
128+
}
129+
130+
@media screen and (max-width: 768px) {
131+
.learn-content {
132+
min-width: 80vw;
133+
margin-left: 10px;
134+
padding-left: 20px;
135+
padding-right: 20px;
136+
}
137+
.chapters {
138+
position: absolute;
139+
z-index: 2;
140+
margin-top: 0px;
141+
min-width: 10vw!important;
142+
}
143+
.chapters.open {
144+
background-color: aliceblue;
145+
}
146+
.chapter-link {
147+
padding: 5px;
148+
padding-left: 10px;
149+
}
150+
.chapter-content {
151+
margin-top: 10px;
152+
margin-bottom: 10px;
153+
}
154+
.chapter-title {
155+
font-size: 2em;
156+
}
157+
.chapter-subheading {
158+
font-size: 1.2em;
159+
}
160+
.content-link {
161+
min-width: 5vw;
162+
}
163+
.content-link button {
164+
width: 100%;
165+
}
166+
.img-div {
167+
margin-top: 10px;
168+
margin-bottom: 10px;
169+
}
170+
.img-div .caption {
171+
font-size: 0.6em;
172+
}
173+
.hline {
174+
margin-top: 10px;
175+
margin-bottom: 10px;
176+
}
177+
.chapter-content span.dark {
178+
font-weight: 400;
179+
}
180+
table.confusion-matrix {
181+
margin-top: 10px;
182+
margin-bottom: 10px;
183+
}
184+
table.confusion-matrix th {
185+
padding: 5px;
186+
}
187+
table.confusion-matrix td {
188+
padding: 5px;
189+
}
190+
.chapter-links-header {
191+
display: flex;
192+
justify-content: end;
193+
margin: 2px;
194+
padding: 5px;
195+
}
196+
.toggle-chapter-links {
197+
position: sticky;
198+
top: 0;
199+
right: 0;
200+
border: 1px solid var(--secondary-color)!important;
201+
border-radius: 5px!important;
202+
width: 30px!important;
203+
height: 30px!important;
204+
color: var(--secondary-color)!important;
205+
}
206+
#chapter-link-open {
207+
opacity: 0.5;
208+
position: sticky!important;
209+
top: 0;
210+
right: 0;
211+
}
212+
.img-div.no-of-clusters {
213+
display: none;
214+
}
215+
}

0 commit comments

Comments
 (0)