diff --git a/assets/sass/layout.scss b/assets/sass/layout.scss index ee5842f40b..012149df8a 100644 --- a/assets/sass/layout.scss +++ b/assets/sass/layout.scss @@ -26,37 +26,6 @@ body { overflow: visible; } -aside { - width: 218px; - margin-bottom: 35px; - position: sticky; - top: 0; - max-height: 100vh; - overflow-y: auto; - /* align with the top of the content */ - padding-top: 46px; -} - -#toc { - border: 1px solid var(--main-border); - padding: .5em; - margin-top: 1rem; - border-top: 1px solid var(--main-border); - background: var(--sidebar-toc-bg-color); - margin-right: 0.5rem; -} - -#toc ul { - list-style-type: square; -} - -#toc li { - /* use margin instead of line height for spacing because sometimes the - headings wrap onto multiple lines */ - line-height: 1.2em; - margin: 6px 0; -} - #content { width: 702px; } @@ -157,47 +126,6 @@ header { } } -// Navigation -aside nav ul { - margin-bottom: 1.4em; - margin-left: 0; - font-size: 16px; - font-weight: bold; - list-style: none; - - li { - margin-bottom: 0.5em; - - a { - color: var(--nav-link-color); - - &.active, &:hover { - color: var(--orange); - } - } - - ul { - display: none; - margin-top: 0.3em; - margin-left: 20px; - font-size: 13px; - font-weight: normal; - - li { - margin-bottom: 0; - - a.active { - font-weight: bold; - } - } - - &.expanded { - display: block; - } - } - } -} - .bottom-nav { @extend .callout; @include clearfix; diff --git a/assets/sass/sidebar.scss b/assets/sass/sidebar.scss index f9420fe6a3..2ee1496e50 100644 --- a/assets/sass/sidebar.scss +++ b/assets/sass/sidebar.scss @@ -9,11 +9,44 @@ hr.sidebar { @include background-image-2x($baseurl + "images/sidebar-divider", 218px, 12px); } +aside { + width: 218px; + margin-bottom: 35px; + top: 0; + max-height: 100vh; + /* align with the top of the content */ + padding-top: 46px; +} + +#toc { + border: 1px solid var(--main-border); + padding: .5em; + margin: 0 -1px 0 0; /* eat the #main border */ + border-right: none; + z-index: 100; + position: relative; + background: var(--main-bg); + + summary { + + } + + ul { + list-style-type: square; + + li { + /* use margin instead of line height for spacing because sometimes the + headings wrap onto multiple lines */ + line-height: 1.2em; + margin: 6px 0; + font-size: 0.8em; + } + } +} + aside.sidebar { - font-size: 13px !important; line-height: $base-line-height * 0.75; p { - font-size: 13px !important; line-height: $base-line-height * 0.75; } @@ -29,6 +62,48 @@ aside.sidebar { } } } + +// Navigation +aside nav ul { + margin-bottom: 1.4em; + margin-left: 0; + font-size: 16px; + font-weight: bold; + list-style: none; + + li { + margin-bottom: 0.5em; + + a { + color: var(--nav-link-color); + + &.active, &:hover { + color: var(--orange); + } + } + + ul { + display: none; + margin-top: 0.3em; + margin-left: 20px; + font-size: 13px; + font-weight: normal; + + li { + margin-bottom: 0; + + a.active { + font-weight: bold; + } + } + + &.expanded { + display: block; + } + } + } +} + // Floating sidebar button for tablet and smaller screens aside.sidebar.active { @include responsive-sidebar-ui; @@ -37,6 +112,11 @@ aside.sidebar.active { display: none; } +aside details, +aside nav { + padding: 0 1.5em; +} + // Breakpoint ---------------- @media (max-width: $default) { .sidebar-btn { diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index aadd84098a..cef929baba 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -49,40 +49,40 @@ Community + - {{ $headings := .Params.headings }} - {{ if $headings }} - - {{ end }} + {{ $headings := .Params.headings }} + {{ if $headings }} +
+ Table of Contents + + +
+ {{ end }} - {{ if (eq .Params.Sidebar "book") }} - - {{- /* If this page displays a section of the ProGit book, map all the translations thereof */ -}} - {{ with $.Page.Params.book }} - {{ $cs_number := .section.cs_number }} - {{ range $.Page.Site.Data.book }} - {{ $language_code := .language_code }} - {{ range .chapters }} - {{ range .sections }} - {{ if (eq .cs_number $cs_number) }} - {{ $.Scratch.SetInMap "translations" $language_code .url }} - {{ end }} + {{ if (eq .Params.Sidebar "book") }} + + {{- /* If this page displays a section of the ProGit book, map all the translations thereof */ -}} + {{ with $.Page.Params.book }} + {{ $cs_number := .section.cs_number }} + {{ range $.Page.Site.Data.book }} + {{ $language_code := .language_code }} + {{ range .chapters }} + {{ range .sections }} + {{ if (eq .cs_number $cs_number) }} + {{ $.Scratch.SetInMap "translations" $language_code .url }} {{ end }} {{ end }} {{ end }} {{ end }} - {{ partial "translations.html" . }} - {{ else if (and (ne $section "documentation") (ne $section "site")) }} - - {{ partial "book.html" }} {{ end }} - + {{ partial "translations.html" . }} + {{ else if (and (ne $section "documentation") (ne $section "site")) }} + + {{ partial "book.html" }} + {{ end }}