_sass/addon/commons.scss in jekyll-theme-chirpy-5.0.2 vs _sass/addon/commons.scss in jekyll-theme-chirpy-5.1.0

- old
+ new

@@ -1,39 +1,32 @@ /* The common styles */ -@import url('https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;900&display=swap'); -@mixin mode-toggle($dark-mode: false) { - @if $dark-mode { - @include dark-scheme; - } @else { - @include light-scheme; +html { + @media (prefers-color-scheme: light) { + &:not([data-mode]), + [data-mode=light] { + @include light-scheme; + } + + &[data-mode=dark] { + @include dark-scheme; + } } -} -html:not([mode]), -html[mode=light] { - @include mode-toggle(); -} + @media (prefers-color-scheme: dark) { + &:not([data-mode]), + &[data-mode=dark] { + @include dark-scheme; + } -html[mode=dark] { - @include mode-toggle(true); -} - -@media (prefers-color-scheme: dark) { - html:not([mode]), - html[mode=dark] { - @include mode-toggle(true); + &[data-mode=light] { + @include light-scheme; + } } - html[mode=light] { - @include mode-toggle(); - } -} - -:root { font-size: 16px; } body { line-height: 1.75rem; @@ -52,11 +45,11 @@ } h2 { @extend %heading; @extend %section; - @extend %anchor-relative; + @extend %anchor; font-size: 1.5rem; } h3 { @@ -102,10 +95,37 @@ blockquote { border-left: 5px solid var(--blockquote-border-color); padding-left: 1rem; color: var(--blockquote-text-color); + + &[class^="prompt-"] { + display: flex; + border-left: 0; + border-radius: 6px; + padding: 0.75rem 1.2rem; + color: var(--prompt-text-color); + + &::before { + margin-right: 1rem; + font-family: "Font Awesome 5 Free"; + text-align: center; + width: 1.25rem; + } + + p:last-child { + margin-bottom: 0rem; + } + } + + @include prompt("tip", "\f0eb", 400); + + @include prompt("info", "\f06a"); + + @include prompt("warning", "\f06a"); + + @include prompt("danger", "\f071"); } kbd { font-family: inherit; display: inline-block; @@ -158,11 +178,11 @@ .footer-right { text-align: right; } } -i { // fontawesome icons +i { /* fontawesome icons */ &.far, &.fas { @extend %no-cursor; } } @@ -189,11 +209,14 @@ margin: 0.75rem 0 1rem 1rem; } &.shadow { filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08)); + box-shadow: none !important; /* cover the Bootstrap 4.6.1 styles */ } + + @extend %img-caption; } /* --- Panels --- */ .access { @@ -222,11 +245,11 @@ } } #panel-wrapper { - // the headings + /* the headings */ .panel-heading { @include label(inherit); } .post-tag { @@ -245,11 +268,11 @@ color: #fff; transition: none; } } - &.topbar-down > div { + [data-topbar-visible=true] & > div { top: 6rem; } } #access-lastmod { @@ -288,11 +311,11 @@ margin-left: 0.25em; margin-top: 0; margin-bottom: 0; } - // [scroll-focus] added by `smooth-scroll.js` + /* [scroll-focus] added by `smooth-scroll.js` */ &:target:not([scroll-focus]), &[scroll-focus=true] > p { background-color: var(--footnote-target-bg); width: fit-content; -webkit-transition: background-color 1.5s ease-in-out; /* Safari prior 6.1 */ @@ -309,11 +332,11 @@ border-bottom-style: none !important; -webkit-transition: background-color 1.5s ease-in-out; /* Safari prior 6.1 */ transition: background-color 1.5s ease-in-out; } - // [scroll-focus] added by `smooth-scroll.js` + /* [scroll-focus] added by `smooth-scroll.js` */ @at-root sup:target:not([scroll-focus]), sup[scroll-focus=true] > a#{&} { background-color: var(--footnote-target-bg); } } @@ -329,11 +352,11 @@ } } /* --- Begin of Markdown table style --- */ -// it will be created by Liquid +/* it will be created by Liquid */ .table-wrapper { overflow-x: auto; margin-bottom: 1.5rem; > table { @@ -363,12 +386,12 @@ td { @extend %table-cell; } } - } // tbody - }// table + } /* tbody */ + }/* table */ } /* --- post --- */ .post { @@ -380,11 +403,11 @@ a { &.img-link { @extend %no-cursor; } - // created by `_includes/img-extra.html` + /* created by `_includes/img-extra.html` */ &.popup { cursor: zoom-in; > img[data-src]:not(.normal):not(.left):not(.right) { @include align-center; @@ -394,11 +417,11 @@ &:hover { code { @extend %link-hover; } } - } // a + } /* a */ } .pageviews .fa-spinner { font-size: 80%; @@ -437,27 +460,22 @@ &:hover { @extend %link-hover; } } - &.img-link + em { - display: block; - text-align: center; - font-style: normal; - font-size: 80%; - padding: 0; - color: #6d6c6c; + &.img-link { + @extend %img-caption; } } ul { - // attribute 'hide-bullet' was added by liquid + /* attribute 'hide-bullet' was added by liquid */ .task-list-item[hide-bullet] { list-style-type: none; - > i { // checkbox icon + > i { /* checkbox icon */ margin: 0 0.4rem 0.2rem -1.4rem; vertical-align: middle; color: var(--checkbox-color); &.checked { @@ -470,19 +488,19 @@ input[type=checkbox] { margin: 0 0.5rem 0.2rem -1.3rem; vertical-align: middle; } - } // ul + } /* ul */ > ol, > ul { padding-left: 2rem; li { ol, - ul { // sub list + ul { /* sub list */ padding-left: 2rem; margin-top: 0.3rem; } } @@ -496,11 +514,11 @@ dl > dd { margin-left: 1rem; } -} // .post-content +} /* .post-content */ .tag:hover { @extend %tag-hover; } @@ -568,14 +586,10 @@ .btn-box-shadow { box-shadow: 0 0 8px 0 var(--btn-box-shadow) !important; } -.topbar-up { - top: -3rem !important; /* same as topbar height. */ -} - .no-text-decoration { @include no-text-decoration; } .tooltip-inner { /* Overrided BS4 Tooltip */ @@ -601,18 +615,18 @@ transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; } /* --- Overriding --- */ -// magnific-popup +/* magnific-popup */ figure .mfp-title { text-align: center; padding-right: 0; margin-top: 0.5rem; } -// mermaid +/* mermaid */ .mermaid { text-align: center; } /* --- sidebar layout --- */ @@ -656,11 +670,11 @@ width: 6rem; height: 6rem; border-radius: 50%; border: 2px solid rgba(222, 222, 222, 0.7); overflow: hidden; - transform: translateZ(0); // fixed the zoom in Safari + transform: translateZ(0); /* fixed the zoom in Safari */ -webkit-transition: border-color 0.35s ease-in-out; -moz-transition: border-color 0.35s ease-in-out; transition: border-color 0.35s ease-in-out; &:hover { @@ -680,11 +694,11 @@ -moz-transform: scale(1.2); -webkit-transform: scale(1.2); transform: scale(1.2); } } - } // #avatar + } /* #avatar */ .site-title { a { @extend %clickable-transition; @@ -699,11 +713,11 @@ font-size: 95%; color: var(--sidebar-muted-color); line-height: 1.2rem; word-spacing: 1px; margin: 0.5rem 1.5rem 0.5rem 1.5rem; - min-height: 3rem; // avoid vertical shifting in multi-line words + min-height: 3rem; /* avoid vertical shifting in multi-line words */ user-select: none; } .nav-link { border-radius: 0; @@ -743,11 +757,11 @@ position: relative; left: $cursor-width / 2; width: 100%; } - &::after { // the cursor + &::after { /* the cursor */ display: table; visibility: hidden; content: ""; position: relative; right: 1px; @@ -756,11 +770,11 @@ border-radius: 1px; background-color: var(--nav-cursor-color); pointer-events: none; } } - } // li + } /* li */ @mixin fix-cursor($top) { top: $top; visibility: visible; } @@ -781,13 +795,13 @@ > li.nav-item:nth-child(#{$i}):last-child:hover::after { @include fix-cursor($top); } } - } // @for + } /* @for */ - } // ul + } /* ul */ .sidebar-bottom { margin-bottom: 2.1rem; @include ml-mr(auto); @@ -834,13 +848,13 @@ width: 3px; height: 3px; border-radius: 50%; } - } // .sidebar-bottom + } /* .sidebar-bottom */ -} // #sidebar +} /* #sidebar */ @media (hover: hover) { #sidebar ul > li:last-child::after { -webkit-transition: top 0.5s ease; -moz-transition: top 0.5s ease; @@ -874,14 +888,18 @@ right: 0; transition: top 0.2s ease-in-out; z-index: 50; border-bottom: 1px solid rgba(0, 0, 0, 0.07); background-color: var(--topbar-wrapper-bg); + + [data-topbar-visible=false] & { + top: -$topbar-height; /* same as topbar height. */ + } } #topbar { - i { // icons + i { /* icons */ color: #999; } #breadcrumb { font-size: 1rem; @@ -899,11 +917,11 @@ padding: 0 0.3rem; } } } } -} // #topbar +} /* #topbar */ #sidebar-trigger, #search-trigger { display: none; } @@ -919,16 +937,10 @@ i { z-index: 2; font-size: 0.9rem; color: var(--search-icon-color); } - - .fa-times-circle { /* button 'clean up' */ - @extend %cursor-pointer; - - visibility: hidden; - } } #search-cancel { /* 'Cancel' link */ color: var(--link-color); margin-left: 1rem; @@ -941,10 +953,11 @@ background: center; border: 0; border-radius: 0; padding: 0.18rem 0.3rem; color: var(--text-color); + height: auto; &:focus { box-shadow: none; background: center; @@ -1004,11 +1017,11 @@ &:not(:last-child) { margin-bottom: 1rem; } - i { // icons + i { /* icons */ color: #818182; margin-right: 0.15rem; font-size: 80%; } @@ -1018,11 +1031,11 @@ display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; } } -} // #search-results +} /* #search-results */ #topbar-title { display: none; font-size: 1.1rem; font-weight: 600; @@ -1088,11 +1101,11 @@ min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}); } } } - div.row:first-of-type:last-of-type { // alone + div.row:first-of-type:last-of-type { /* alone */ margin-bottom: 4rem; } } #topbar-wrapper.row, @@ -1141,12 +1154,30 @@ */ @media all and (max-width: 576px) { - $footer-height: $footer-height-mobile; // overwrite + $footer-height: $footer-height-mobile; /* overwrite */ + footer { + height: $footer-height; + + > div.d-flex { + width: 100%; + padding: 1.5rem 0; + margin-bottom: 0.3rem; + flex-wrap: wrap; + -ms-flex-pack: distribute !important; + justify-content: space-around !important; + } + + .footer-left, + .footer-right { + text-align: center; + } + } + #main > div.row:first-child > div:first-child { min-height: calc(100vh - #{$topbar-height} - #{$footer-height}); } #core-wrapper { @@ -1154,10 +1185,18 @@ h1 { margin-top: 2.2rem; font-size: 1.75rem; } + + .post-content { + > blockquote[class^=prompt-] { + @include ml-mr(-1.25rem); + border-radius: 0; + } + } + } #avatar > a { width: 5rem; height: 5rem; @@ -1169,78 +1208,56 @@ #main-wrapper { padding-bottom: $footer-height; } - footer { - height: $footer-height; - - > div.d-flex { - width: 100%; - padding: 1.5rem 0; - margin-bottom: 0.3rem; - flex-wrap: wrap; - -ms-flex-pack: distribute !important; - justify-content: space-around !important; - } - - .footer-left, - .footer-right { - text-align: center; - } - } - } /* hide sidebar and panel */ @media all and (max-width: 849px) { - %slide { - -webkit-transition: transform 0.4s ease; - transition: transform 0.4s ease; + @mixin slide($append: null) { + $basic: transform 0.4s ease; + @if $append { + -webkit-transition: $basic, $append; + transition: $basic, $append; + } @else { + -webkit-transition: $basic; + transition: $basic; + } } html, body { overflow-x: hidden; } - .footnotes ol > li { - padding-top: 3.5rem; - margin-top: -3.2rem; - - &:first-child { - margin-top: -3.5rem; - } - } - [#{$sidebar-display}] { #sidebar { transform: translateX(0); } #topbar-wrapper, #main-wrapper { transform: translateX(#{$sidebar-width}); } - } #sidebar { - @extend %slide; + @include slide; - transform: translateX(-#{$sidebar-width}); // hide + transform: translateX(-#{$sidebar-width}); /* hide */ -webkit-transform: translateX(-#{$sidebar-width}); .cursor { -webkit-transition: none; -moz-transition: none; transition: none; } } #main-wrapper { - @extend %slide; + @include slide; padding-top: $topbar-height; } #search-result-wrapper { @@ -1251,19 +1268,15 @@ #search-wrapper { display: none; } #topbar-wrapper { - @extend %slide; + @include slide(top 0.2s ease); left: 0; } - .topbar-up { - top: 0 !important; - } - #main > div.row:first-child > div:nth-child(1), #main > div.row:first-child > div:nth-child(2) { margin-top: 0; } @@ -1275,14 +1288,10 @@ #search-wrapper { &.loaded ~ a { margin-right: 1rem; } - - .fa-times-circle { - right: 5.2rem; - } } #search-input { margin-left: 0; width: 95%; @@ -1304,12 +1313,18 @@ ~ .post-content { margin-top: 3rem; } } -} // max-width: 849px +} /* max-width: 849px */ +@media all and (max-width: 849px) and (orientation: portrait) { + [data-topbar-visible=false] #topbar-wrapper { + top: 0; + } +} + /* Phone & Pad */ @media all and (min-width: 577px) and (max-width: 1199px) { footer > .d-flex > div { width: 312px; } @@ -1351,14 +1366,10 @@ #back-to-top { bottom: 5.5rem; right: 1.2rem; } - .topbar-up { - box-shadow: none !important; - } - #topbar-title { text-align: left; } footer > div.d-flex { @@ -1521,14 +1532,10 @@ > div { max-width: 1110px; } } - #search-wrapper .fa-times-circle { - right: 2.6rem; - } - } @media all and (min-width: 1400px) and (max-width: 1650px) { #topbar { padding-right: 2rem; @@ -1611,11 +1618,11 @@ word-spacing: 0; margin-top: 0.3rem; } - } // .profile-wrapper (min-width: 1650px) + } /* .profile-wrapper (min-width: 1650px) */ ul { padding-left: 2.5rem; > li:last-child { @@ -1658,11 +1665,11 @@ > button.mode-toggle, > a { @include ml-mr(0.15rem); height: $icon-block-size; - margin-bottom: 0.5rem; // wrap line + margin-bottom: 0.5rem; /* wrap line */ } i { background-color: var(--sidebar-btn-bg); font-size: 1rem; @@ -1681,13 +1688,13 @@ .icon-border { top: 0.9rem; } - } // .sidebar-bottom + } /* .sidebar-bottom */ - } // #sidebar + } /* #sidebar */ footer > div.d-flex { width: 92%; max-width: 1140px; } @@ -1696,10 +1703,10 @@ > div { max-width: #{$main-content-max-width}; } } -} // min-width: 1650px +} /* min-width: 1650px */ @media all and (min-width: 1700px) { #topbar-wrapper { /* 100% - 350px - (1920px - 350px); */ padding-right: calc(100% - #{$sidebar-width-large} - (1920px - #{$sidebar-width-large}));