Skip to content

Commit

Permalink
Fix tutorial layout and ToC on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfeldman committed Nov 20, 2023
1 parent 9cd4a83 commit edfba00
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
5 changes: 4 additions & 1 deletion www/content/tutorial.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<nav id="tutorial-toc">
<input id="tutorial-toc-toggle" name="tutorial-toc-toggle" type= "checkbox">
<nav id="tutorial-toc" aria-label="Table of Contents">
<label id="close-tutorial-toc" for="tutorial-toc-toggle">close</label>
<!-- TODO fix search: input [id "toc-search", type "text", placeholder "Search"] [] -->
<ol>
<li><a href="#repl">REPL</a></li>
<li><a href="#building-an-application">Building an Application</a></li>
Expand Down
41 changes: 35 additions & 6 deletions www/public/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ h3 {
padding: 4px;
}

#tutorial-toc-toggle:checked+#tutorial-toc {
display: block;
}

.home-link-text {
padding: 8px;
font-size: 24px;
Expand Down Expand Up @@ -533,8 +537,21 @@ li {
--body-max-width: none;
}

#tutorial-main main {
max-width: none;
#tutorial-main main, #tutorial-toc-toggle-label, #close-tutorial-toc {
display: block !important;
}

#tutorial-toc {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow-y: auto;
margin: 0 !important;
padding-right: 120px;
border: 0;
}

#homepage-logo {
Expand Down Expand Up @@ -1197,6 +1214,7 @@ code .dim {
}

#tutorial-toc {
position: relative;
background-color: var(--gray-bg);
flex: 0 0 auto; /* Take up as much space as it needs */
margin-top: 30px;
Expand Down Expand Up @@ -1264,18 +1282,29 @@ code .dim {
/* This may be overridden on mobile-friendly screen widths */
}

#tutorial-toc-toggle:hover,
#tutorial-toc-toggle-label:hover,
#close-tutorial-toc:hover {
text-decoration: underline;
cursor: pointer;
}

#tutorial-toc-toggle,
#tutorial-toc-toggle-label {
font-size: 1.1rem;
font-size: 1.2rem;
float: right;
padding: 0 1rem;
font-family: Lato;
font-weight: normal;
}

#close-tutorial-toc {
position: absolute;
top: 20px;
right: 8px;
font-size: 18px;
top: 1rem;
right: 1rem;
font-size: 1.2rem;
padding: 12px 24px;
font-weight: bold;
}

/* for larger screens */
Expand Down

0 comments on commit edfba00

Please sign in to comment.