enable left sidebar every time

This commit is contained in:
zhixuan 2022-02-13 21:18:54 +09:00
parent 4b0dbb4630
commit 727f95010d
No known key found for this signature in database
GPG Key ID: 05D14AD50C51A06F
5 changed files with 29 additions and 100 deletions

View File

@ -10,7 +10,7 @@
max-width: var(--right-sidebar-max-width); max-width: var(--right-sidebar-max-width);
/// Display right sidebar when min-width: lg /// Display right sidebar when min-width: lg
@include respond(lg) { @include respond(xl) {
display: block; display: block;
} }
} }
@ -18,38 +18,21 @@
&.extended { &.extended {
@include respond(md) { @include respond(md) {
max-width: 1024px; max-width: 1024px;
--left-sidebar-max-width: 25%;
--right-sidebar-max-width: 30%;
}
@include respond(lg) {
max-width: 1280px;
--left-sidebar-max-width: 20%;
--right-sidebar-max-width: 30%;
}
@include respond(xl) {
max-width: 1536px;
--left-sidebar-max-width: 15%; --left-sidebar-max-width: 15%;
--right-sidebar-max-width: 25%;
}
}
&.compact {
@include respond(md) {
--left-sidebar-max-width: 25%;
max-width: 768px;
} }
@include respond(lg) { @include respond(lg) {
max-width: 1024px; max-width: 1280px;
--left-sidebar-max-width: 20%; --right-sidebar-max-width: 20%;
} }
@include respond(xl) { @include respond(xl) {
max-width: 1280px; max-width: 1800px;
--left-sidebar-max-width: 10%;
--right-sidebar-max-width: 20%;
} }
} }
} }
.flex { .flex {
@ -102,7 +85,12 @@ main.main {
align-items: flex-start; align-items: flex-start;
padding: 0 15px; padding: 0 15px;
column-gap: var(--section-separation); column-gap: var(--section-separation);
align-items: start;
flex-direction: column;
@include respond(md) {
flex-direction: row;
}
@include respond(md) { @include respond(md) {
padding: 0 20px; padding: 0 20px;
} }

View File

@ -122,66 +122,6 @@
} }
} }
.article-page.has-toc {
.left-sidebar {
display: none;
}
.right-sidebar {
width: 100%;
padding: 0;
display: none;
@include respond(xl) {
display: block;
top: var(--main-top-padding);
}
}
#article-toolbar {
display: block;
@include respond(md) {
padding: 0;
}
@include respond(xl) {
margin-top: 0;
position: sticky;
top: var(--main-top-padding);
flex-shrink: 1;
a {
background: transparent;
box-shadow: none;
border: 1px solid var(--body-text-color);
width: 100%;
margin-right: 0;
svg {
flex-shrink: 0;
}
}
}
}
.main-container {
align-items: start;
flex-direction: column;
@include respond(xl) {
flex-direction: row;
}
}
.main {
padding-top: 0;
@include respond(xl) {
padding-top: var(--main-top-padding);
}
}
}
.widget--toc { .widget--toc {
background-color: var(--card-background); background-color: var(--card-background);
@ -299,7 +239,11 @@
&.has-image { &.has-image {
.article-details { .article-details {
padding: 20px; padding: 20px;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.75) 100%); background: linear-gradient(
0deg,
rgba(0, 0, 0, 0.25) 0%,
rgba(0, 0, 0, 0.75) 100%
);
} }
} }
} }
@ -338,7 +282,8 @@
blockquote { blockquote {
position: relative; position: relative;
margin: 1.5em 0; margin: 1.5em 0;
border-left: var(--blockquote-border-size) solid var(--card-separator-color); border-left: var(--blockquote-border-size) solid
var(--card-separator-color);
padding: 15px calc(var(--card-padding) - var(--blockquote-border-size)); padding: 15px calc(var(--card-padding) - var(--blockquote-border-size));
background-color: var(--blockquote-background-color); background-color: var(--blockquote-background-color);
} }

View File

@ -37,6 +37,14 @@
} }
.right-sidebar { .right-sidebar {
width: 100%;
padding: 0;
display: none;
@include respond(xl) {
display: block;
top: var(--main-top-padding);
}
flex-shrink: 0; flex-shrink: 0;
display: none; display: none;

View File

@ -181,7 +181,7 @@ menu:
weight: -100 weight: -100
params: params:
### For demonstration purpose, the home link will be open in a new tab ### For demonstration purpose, the home link will be open in a new tab
newTab: true newTab: false
icon: home icon: home
social: social:

View File

@ -1,7 +1,7 @@
{{ define "body-class" }} {{ define "body-class" }}
{{ $TOCEnabled := default (default false .Site.Params.article.toc) .Params.toc }} {{ $TOCEnabled := default (default false .Site.Params.article.toc) .Params.toc }}
{{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}} {{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}}
article-page {{ if (.Scratch.Get "hasTOC") }}has-toc{{ end }} article-page
{{ end }} {{ end }}
{{ define "container-class" }} {{ define "container-class" }}
@ -30,18 +30,6 @@
{{ partialCached "article/components/photoswipe" . }} {{ partialCached "article/components/photoswipe" . }}
{{ end }} {{ end }}
{{ define "left-sidebar" }}
{{ if (.Scratch.Get "hasTOC") }}
<div id="article-toolbar">
<a href="{{ .Site.BaseURL | relLangURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>{{ T "article.back" }}</span>
</a>
</div>
{{ else }}
{{ partial "sidebar/left.html" . }}
{{ end }}
{{ end }}
{{ define "right-sidebar" }} {{ define "right-sidebar" }}
{{ if (.Scratch.Get "hasTOC") }} {{ if (.Scratch.Get "hasTOC") }}