Skip to content
Open
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
72 changes: 0 additions & 72 deletions assets/sass/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
84 changes: 82 additions & 2 deletions assets/sass/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -37,6 +112,11 @@ aside.sidebar.active {
display: none;
}

aside details,
aside nav {
padding: 0 1.5em;
}

// Breakpoint ----------------
@media (max-width: $default) {
.sidebar-btn {
Expand Down
58 changes: 29 additions & 29 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,40 @@
<a href="{{ relURL "community" }}"{{ if (eq $section "community") }} class="active"{{ end }}>Community</a>
</li>
</ul>
</nav>

{{ $headings := .Params.headings }}
{{ if $headings }}
<ul id="toc">
<li> Table of Contents
<ul class="expanded">
{{ range $i, $item := $headings }}
<li><a href="#{{ .id }}">{{ .text }}</a> </li>
{{ end }}
</ul>
</li>
</ul>
{{ end }}
{{ $headings := .Params.headings }}
{{ if $headings }}
<details id="toc" open>
<summary>Table of Contents</summary>
<ul>
{{ range $i, $item := $headings }}
<li><a href="#{{ .id }}">{{ .text }}</a> </li>
{{ end }}
</ul>
</li>
</details>
{{ end }}

{{ if (eq .Params.Sidebar "book") }}
<hr class="sidebar">
{{- /* 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") }}
<hr class="sidebar">
{{- /* 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")) }}
<hr class="sidebar">
{{ partial "book.html" }}
{{ end }}
</nav>
{{ partial "translations.html" . }}
{{ else if (and (ne $section "documentation") (ne $section "site")) }}
<hr class="sidebar">
{{ partial "book.html" }}
{{ end }}
Comment on lines -66 to +87
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the translated books may want to stay in the <nav> bar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the translated books may want to stay in the

bar?

@dscho Maybe, yes. I didn't check the book yet. I should have. Putting it on my list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dscho Why are book translations in the sidebar and man page translations at the top? I think they all should go in the top nav.

</aside>
Loading