Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Visness b75b59aad5 Add highlight to currently-selected education course 2022-10-31 17:39:19 -05:00
Ben Visness 2fbdf19f41 Fix the HTTP article slug 2022-10-31 16:01:42 -05:00
4 changed files with 38 additions and 1 deletions

View File

@ -8306,6 +8306,13 @@ nav.timecodes {
text-align: center; text-align: center;
margin: 10px 0; } margin: 10px 0; }
.edu-course.highlight {
border-left: 0.25rem solid black;
border-color: #666;
border-color: var(--link-color);
background-color: #ccc;
background-color: var(--theme-color-dimmest); }
.edu-course .edu-article.coming-soon { .edu-course .edu-article.coming-soon {
font-style: italic; } font-style: italic; }

View File

@ -1,4 +1,10 @@
.edu-course { .edu-course {
&.highlight {
border-left: 0.25rem solid black;
@include usevar(border-color, link-color);
@include usevar(background-color, theme-color-dimmest);
}
.edu-article.coming-soon { .edu-article.coming-soon {
@extend .c--dimmer; @extend .c--dimmer;
font-style: italic; font-style: italic;

View File

@ -85,5 +85,29 @@
<div><a href="{{ .NewArticleUrl }}"><span class="big pr1">+</span> New Article</a></div> <div><a href="{{ .NewArticleUrl }}"><span class="big pr1">+</span> New Article</a></div>
</div> </div>
{{ end }} {{ end }}
<script>
function highlightHash(hash) {
if (!hash) {
return;
}
const courses = document.querySelectorAll('.edu-course');
for (const course of courses) {
course.classList.remove('highlight');
}
const selectedCourse = document.querySelector(hash);
if (selectedCourse) {
selectedCourse.classList.add('highlight');
}
}
highlightHash(window.location.hash);
for (const a of document.querySelectorAll('a.edu-topic')) {
a.addEventListener('click', e => {
highlightHash(e.target.closest('a').hash);
});
}
</script>
</div> </div>
{{ end }} {{ end }}

View File

@ -69,7 +69,7 @@ func EducationIndex(c *RequestContext) ResponseData {
Name: "Networking", Name: "Networking",
Slug: "networking", Slug: "networking",
Articles: []templates.EduArticle{ Articles: []templates.EduArticle{
article("networking"), article("http"),
{ {
Title: "Internet infrastructure", Title: "Internet infrastructure",
Description: "How does the internet actually work? How does your ISP know where to send your data? What happens to the internet if physical communication breaks down?", Description: "How does the internet actually work? How does your ISP know where to send your data? What happens to the internet if physical communication breaks down?",