Add a hook for custom variables (fix #355)

This commit is contained in:
Cotes Chung 2021-07-04 21:01:11 +08:00
parent 5f1e6e9350
commit c98a41317f
5 changed files with 38 additions and 27 deletions

View file

@ -596,8 +596,6 @@ figure .mfp-title {
/* --- sidebar layout --- */
$tab-count: 5 !default;
$sidebar-display: "sidebar-display";
#sidebar {
@ -608,7 +606,7 @@ $sidebar-display: "sidebar-display";
left: 0;
height: 100%;
overflow-y: auto;
width: $sidebar-width-medium;
width: $sidebar-width;
z-index: 99;
background: var(--sidebar-bg);
@ -717,7 +715,6 @@ $sidebar-display: "sidebar-display";
width: 100%;
&:last-child {
$cursor-width: 3px;
a {
position: relative;
@ -846,7 +843,7 @@ $sidebar-display: "sidebar-display";
height: $topbar-height;
position: fixed;
top: 0;
left: 260px; /* same as sidebar width */
left: $sidebar-width; /* same as sidebar width */
right: 0;
transition: top 0.2s ease-in-out;
z-index: 50;
@ -1090,7 +1087,7 @@ $sidebar-display: "sidebar-display";
@media all and (max-width: 576px) {
$footer-height: 6rem; // overwrite
$footer-height: $footer-height-mobile; // overwrite
#main > div.row:first-child > div:first-child {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
@ -1164,7 +1161,7 @@ $sidebar-display: "sidebar-display";
#topbar-wrapper,
#main-wrapper {
transform: translateX(#{$sidebar-width-medium});
transform: translateX(#{$sidebar-width});
}
}
@ -1172,8 +1169,8 @@ $sidebar-display: "sidebar-display";
#sidebar {
@extend %slide;
transform: translateX(-#{$sidebar-width-medium}); // hide
-webkit-transform: translateX(-#{$sidebar-width-medium});
transform: translateX(-#{$sidebar-width}); // hide
-webkit-transform: translateX(-#{$sidebar-width});
.cursor {
-webkit-transition: none;
@ -1271,7 +1268,7 @@ $sidebar-display: "sidebar-display";
}
#main-wrapper {
margin-left: $sidebar-width-medium;
margin-left: $sidebar-width;
}
.profile-wrapper {

View file

@ -39,8 +39,6 @@ html[mode=dark] {
padding: 1.5rem;
}
$code-font-size: 0.85rem;
div > pre {
@extend %code-snippet-bg;
@extend %code-snippet-radius;

View file

@ -1,22 +1,34 @@
/*
* Mainly scss variables
*/
* The SCSS variables
*/
/* --- ↓ width and height ---- */
/* sidebar */
$tab-height: 3.2rem;
$tab-cursor-height: 1.6rem;
$sidebar-width: 260px !default; // the basic width
$sidebar-width-small: 210px !default; // screen width: >= 850px, <= 1199px (iPad landscape)
$sidebar-width-large: 350px !default; // screen width: >= 1650px
$sidebar-width-small: 210px;
$sidebar-width-medium: 260px;
$sidebar-width-large: 350px;
/* tabs of sidebar */
$topbar-height: 3rem;
$tab-count: 5 !default; // backward compatible (version <= 4.0.2)
$tab-height: 3.2rem !default;
$tab-cursor-height: 1.6rem !default;
$footer-height: 5rem;
$cursor-width: 3px !default; // the cursor width of the selected tab
$main-content-max-width: 1150px;
/* other framework sizes */
$panel-max-width: 300px;
$topbar-height: 3rem !default;
$post-extend-min-height: 35rem;
$footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; // screen width: <= 576px
$main-content-max-width: 1150px !default;
$panel-max-width: 300px !default;
$post-extend-min-height: 35rem !default;
/* syntax highlight */
$code-font-size: 0.85rem !default;

View file

@ -1,7 +1,6 @@
---
---
// see: /_sass/addon/commons.scss
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
{% include_relative variables-hook.scss %}
@import "jekyll-theme-chirpy";

View file

@ -0,0 +1,5 @@
/*
Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss`
*/
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab