Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,89 @@ body {
}
}

// Table of contents sidebar, used by the long pages (see partials/toc.html)

.with-toc,
.with-toc-body {
display: flex;
flex-direction: column;
min-width: 0;
}

.toc {
display: none;
}

// Only worth a column when there is room for one beside the content
@media (min-width: 75rem) {
#page-content:has(.with-toc) {
max-width: $maxwidthwide;
width: $contentwidthwide;
}

.with-toc {
display: grid;
grid-template-columns: 13rem minmax(0, 1fr);
gap: 3.5rem;
align-items: start;
}

.toc {
display: block;
position: sticky;
top: 2rem;
max-height: calc(100vh - 4rem);
overflow-y: auto;
// The body column starts with the h1, so drop the list to roughly its baseline
margin-top: 4.5rem;

&[hidden] {
display: none;
}

.toc-title {
margin: 0 0 0.6rem 0.75rem;
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: $greydesc;
}

ul {
margin: 0;
padding: 0;
list-style: none;
border-left: 1px solid $overline;
}

li a {
display: block;
padding: 0.35rem 0.75rem;
margin-left: -1px;
border-left: 2px solid transparent;
font-size: 0.9rem;
line-height: 1.35;
color: $greydesc;
text-decoration: none;
transition: all 200ms ease-in-out;

&:hover {
color: black;
}
&.is-current {
color: black;
border-left-color: $tiletext;
}
}

.toc-h3 a {
padding-left: 1.5rem;
font-size: 0.85rem;
}
}
}

// Specific to /people

#people-content .team .team-list {
Expand Down
103 changes: 54 additions & 49 deletions layouts/learn/list.html
Original file line number Diff line number Diff line change
@@ -1,64 +1,69 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
<article class="post">
<div class="post-content" id="tutorials-content">
{{ if .Params.tutorials }}
{{ .Params.tutorials_intro | markdownify }}
<div class="with-toc">
{{ partial "toc.html" . }}
<div class="with-toc-body">
<h1>{{ .Title }}</h1>
<article class="post">
<div class="post-content" id="tutorials-content">
{{ if .Params.tutorials }}
{{ .Params.tutorials_intro | markdownify }}

{{ $jsonURL := "https://scverse.org/scverse-tutorials/tutorials.json" }}
{{ $remoteData := resources.GetRemote $jsonURL }}
{{ $content := transform.Unmarshal $remoteData.Content }}
{{ if $content }}
{{ $jsonURL := "https://scverse.org/scverse-tutorials/tutorials.json" }}
{{ $remoteData := resources.GetRemote $jsonURL }}
{{ $content := transform.Unmarshal $remoteData.Content }}
{{ if $content }}

<h2 id="tutorials">Tutorials</h2>
<h2 id="tutorials">Tutorials</h2>

<div id="ecosystem-tutorials">
<input
type="text"
class="form-control"
id="tutorial-filter"
onkeyup="filterTutorials()"
placeholder="Search through {{ len $content.tutorials }} tutorials"
title="Type in your search query"
/>
<div id="ecosystem-tutorials">
<input
type="text"
class="form-control"
id="tutorial-filter"
onkeyup="filterTutorials()"
placeholder="Search through {{ len $content.tutorials }} tutorials"
title="Type in your search query"
/>

{{ range $cat := $content.categories }}
{{ range $catname, $catmore := $cat }}
{{ $ts := where $content.tutorials "primary_category" $catname }}
{{ if (gt ($ts | len) 0) }}
<h3>{{ $catname }}</h3>
<p>{{ $catmore.description }}</p>
{{ range $cat := $content.categories }}
{{ range $catname, $catmore := $cat }}
{{ $ts := where $content.tutorials "primary_category" $catname }}
{{ if (gt ($ts | len) 0) }}
<h3>{{ $catname }}</h3>
<p>{{ $catmore.description }}</p>

<div class="tutorials-list">
{{ range $t := $ts }}
<div class="card tutorial-item border-0">
<a href="{{ $t.link }}" target="_blank">
{{ if $t.image }}
<img
class="card-img-top"
src="https://scverse.org/scverse-tutorials/{{ $t.image }}"
alt="Tutorial logo"
/>
{{ end }}
<div class="card-body">
<h5 class="card-title">
{{ $t.name }}
</h5>
<p>{{ $t.description }}</p>
<div class="tutorials-list">
{{ range $t := $ts }}
<div class="card tutorial-item border-0">
<a href="{{ $t.link }}" target="_blank">
{{ if $t.image }}
<img
class="card-img-top"
src="https://scverse.org/scverse-tutorials/{{ $t.image }}"
alt="Tutorial logo"
/>
{{ end }}
<div class="card-body">
<h5 class="card-title">
{{ $t.name }}
</h5>
<p>{{ $t.description }}</p>
</div>
</a>
</div>
</a>
{{ end }}
</div>
{{ end }}
</div>

{{ end }}
{{ end }}

{{ end }}
</div>
{{ end }}

</div>
{{ end }}

{{ end }}
{{ end }}
</div>
</article>
</div>
</article>
</div>
{{ end }}
Loading