Refactor @import

This commit is contained in:
Mimi 2021-09-07 00:51:01 +08:00
parent 1be8cbb18b
commit 989157a853
24 changed files with 514 additions and 498 deletions

View File

@ -1,14 +0,0 @@
.back-to-top {
margin: 20px - $sidebar-offset -10px -20px;
opacity: 0;
transition: opacity $transition-ease;
&.back-to-top-on {
cursor: pointer;
opacity: $b2t-opacity;
&:hover {
opacity: $b2t-opacity-hover;
}
}
}

View File

@ -1,20 +1,45 @@
.back-to-top { if (hexo-config('back2top.enable')) {
bottom: $b2t-position-bottom; .back-to-top {
box-sizing: border-box; font-size: $b2t-font-size;
color: $b2t-color;
padding: 0 6px;
transition: bottom $transition-ease;
sidebar-toggle();
if (not hexo-config('back2top.scrollpercent')) { if (not hexo-config('back2top.scrollpercent')) {
width: 24px; span {
} display: none;
}
}
&:hover { if (hexo-config('back2top.sidebar')) {
color: $sidebar-highlight; margin: 20px - $sidebar-offset -10px -20px;
} opacity: 0;
transition: opacity $transition-ease;
&.back-to-top-on { &.back-to-top-on {
bottom: $b2t-position-bottom-on; cursor: pointer;
opacity: $b2t-opacity;
&:hover {
opacity: $b2t-opacity-hover;
}
}
} else {
bottom: $b2t-position-bottom;
box-sizing: border-box;
color: $b2t-color;
padding: 0 6px;
transition: bottom $transition-ease;
sidebar-toggle();
if (not hexo-config('back2top.scrollpercent')) {
width: 24px;
}
&:hover {
color: $sidebar-highlight;
}
&.back-to-top-on {
bottom: $b2t-position-bottom-on;
}
}
} }
} }

View File

@ -1,17 +1,3 @@
if (hexo-config('back2top.enable')) {
.back-to-top {
font-size: $b2t-font-size;
if (not hexo-config('back2top.scrollpercent')) {
span {
display: none;
}
}
}
@import (hexo-config('back2top.sidebar') ? 'back-to-top-sidebar' : 'back-to-top');
}
.noscript-warning { .noscript-warning {
background-color: lighten($red, 20%); background-color: lighten($red, 20%);
color: white; color: white;
@ -26,7 +12,8 @@ if (hexo-config('back2top.enable')) {
z-index: $zindex-5; z-index: $zindex-5;
} }
@import 'reading-progress' if (hexo-config('reading_progress.enable')); @import 'back-to-top';
@import 'reading-progress';
@import 'post'; @import 'post';
@import 'pages'; @import 'pages';

View File

@ -50,5 +50,4 @@
@import 'post-footer'; @import 'post-footer';
@import 'post-widgets'; @import 'post-widgets';
@import 'post-reward'; @import 'post-reward';
@import 'post-followme';
@import 'post-followme' if (hexo-config('follow_me'));

View File

@ -1,32 +1,34 @@
.followme { if (hexo-config('follow_me')) {
color: $grey; .followme {
padding: 1em 1.5em; color: $grey;
text-align: center; padding: 1em 1.5em;
post-card(); text-align: center;
post-card();
.social-list { .social-list {
flex-wrap(); flex-wrap();
.social-item { .social-item {
margin: .5em 2em; margin: .5em 2em;
+tablet-mobile() { +tablet-mobile() {
margin: .5em .75em; margin: .5em .75em;
} }
}
.social-link {
border: 0;
display:inline-block;
text-align: center;
.icon {
font-size: 1.75em;
} }
.label { .social-link {
display: block; border: 0;
font-size: 14px; display:inline-block;
text-align: center;
.icon {
font-size: 1.75em;
}
.label {
display: block;
font-size: 14px;
}
} }
} }
} }

View File

@ -1,25 +1,27 @@
.reading-progress-bar { if (hexo-config('reading_progress.enable')) {
--progress: 0; .reading-progress-bar {
background: unquote(hexo-config('reading_progress.color')); --progress: 0;
height: unquote(hexo-config('reading_progress.height')); background: unquote(hexo-config('reading_progress.color'));
position: fixed; height: unquote(hexo-config('reading_progress.height'));
z-index: $zindex-5; position: fixed;
z-index: $zindex-5;
if (hexo-config('reading_progress.reversed')) { if (hexo-config('reading_progress.reversed')) {
width: calc(100% - var(--progress)); width: calc(100% - var(--progress));
} else { } else {
width: var(--progress); width: var(--progress);
} }
if (hexo-config('reading_progress.start_at') == 'right') { if (hexo-config('reading_progress.start_at') == 'right') {
right: 0; right: 0;
} else { } else {
left: 0; left: 0;
} }
if (hexo-config('reading_progress.position') == 'bottom') { if (hexo-config('reading_progress.position') == 'bottom') {
bottom: 0; bottom: 0;
} else { } else {
top: 0; top: 0;
}
} }
} }

View File

@ -1,7 +1,9 @@
.gt-header a, .gt-comments a, .gt-popup a { if (hexo-config('gitalk.enable')) {
border-bottom: 0; .gt-header a, .gt-comments a, .gt-popup a {
} border-bottom: 0;
}
.gt-container .gt-popup .gt-action.is--active::before { .gt-container .gt-popup .gt-action.is--active::before {
top: .7em; top: .7em;
}
} }

View File

@ -1,12 +1,8 @@
@import 'gitalk' if (hexo-config('gitalk.enable')); @import 'gitalk';
@import 'utterances';
@import 'utterances' if (hexo-config('utterances.enable')); @import 'search';
@import 'related-posts';
@import 'search' if (hexo-config('local_search.enable') || hexo-config('algolia_search.enable')); @import 'math';
@import 'related-posts' if (hexo-config('related_posts.enable'));
@import 'math' if (hexo-config('math.mathjax.enable'));
.use-motion .animated { .use-motion .animated {
// Fix issue #48 #55 // Fix issue #48 #55

View File

@ -1,7 +1,9 @@
mjx-container[jax="CHTML"][display="true"], .has-jax { if (hexo-config('math.mathjax.enable')) {
overflow: auto hidden; mjx-container[jax="CHTML"][display="true"], .has-jax {
} overflow: auto hidden;
}
mjx-container[display="true"] + br { mjx-container[display="true"] + br {
display: none; display: none;
}
} }

View File

@ -1,21 +1,23 @@
.popular-posts-header { if (hexo-config('related_posts.enable')) {
border-bottom: 1px solid $gainsboro; .popular-posts-header {
font-size: $font-size-large; border-bottom: 1px solid $gainsboro;
margin-bottom: 10px; font-size: $font-size-large;
margin-top: $post-eof-margin-bottom; margin-bottom: 10px;
} margin-top: $post-eof-margin-bottom;
}
.popular-posts { .popular-posts {
padding: 0; padding: 0;
.popular-posts-item { .popular-posts-item {
margin-left: 2em; margin-left: 2em;
.popular-posts-title { .popular-posts-title {
font-size: $font-size-small; font-size: $font-size-small;
font-weight: normal; font-weight: normal;
line-height: $line-height-base * 1.2; line-height: $line-height-base * 1.2;
margin: 0; margin: 0;
}
} }
} }
} }

View File

@ -1,103 +1,105 @@
.search-active { if (hexo-config('local_search.enable') or hexo-config('algolia_search.enable')) {
overflow: hidden; .search-active {
} overflow: hidden;
.search-pop-overlay {
background: rgba(0, 0, 0, 0);
display: flex;
height: 100%;
left: 0;
position: fixed;
top: 0;
transition: visibility .4s, background .4s;
visibility: hidden;
width: 100%;
z-index: $zindex-4;
.search-active & {
background: rgba(0, 0, 0, .3);
visibility: visible;
}
}
.search-popup {
background: var(--card-bg-color);
border-radius: 5px;
height: 80%;
margin: auto;
transform: scale(0);
transition: transform .4s;
width: 700px;
.search-active & {
transform: scale(1);
} }
+mobile() { .search-pop-overlay {
border-radius: 0; background: rgba(0, 0, 0, 0);
height: 100%;
width: 100%;
}
.search-icon, .popup-btn-close {
color: $grey-dark;
font-size: 18px;
padding: 0 10px;
}
.popup-btn-close {
cursor: pointer;
&:hover .fa {
color: $black-deep;
}
}
.search-header {
background: $gainsboro;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: flex; display: flex;
padding: 5px; height: 100%;
} left: 0;
position: fixed;
input.search-input { top: 0;
background: transparent; transition: visibility .4s, background .4s;
border: 0; visibility: hidden;
outline: 0;
width: 100%; width: 100%;
z-index: $zindex-4;
&::-webkit-search-cancel-button { .search-active & {
display: none; background: rgba(0, 0, 0, .3);
visibility: visible;
} }
} }
.search-result-container { .search-popup {
height: calc(100% - 55px); background: var(--card-bg-color);
overflow: auto; border-radius: 5px;
padding: 5px 25px; height: 80%;
margin: auto;
transform: scale(0);
transition: transform .4s;
width: 700px;
hr { .search-active & {
margin: 5px 0 10px; transform: scale(1);
}
&:first-child { +mobile() {
border-radius: 0;
height: 100%;
width: 100%;
}
.search-icon, .popup-btn-close {
color: $grey-dark;
font-size: 18px;
padding: 0 10px;
}
.popup-btn-close {
cursor: pointer;
&:hover .fa {
color: $black-deep;
}
}
.search-header {
background: $gainsboro;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: flex;
padding: 5px;
}
input.search-input {
background: transparent;
border: 0;
outline: 0;
width: 100%;
&::-webkit-search-cancel-button {
display: none; display: none;
} }
} }
}
.search-result-list { .search-result-container {
margin: 0 5px; height: calc(100% - 55px);
padding: 0; overflow: auto;
} padding: 5px 25px;
a.search-result-title { hr {
font-weight: bold; margin: 5px 0 10px;
}
p.search-result { &:first-child {
border-bottom: 1px dashed $grey-light; display: none;
padding: 5px 0; }
}
}
.search-result-list {
margin: 0 5px;
padding: 0;
}
a.search-result-title {
font-weight: bold;
}
p.search-result {
border-bottom: 1px dashed $grey-light;
padding: 5px 0;
}
} }
} }

View File

@ -1,3 +1,5 @@
.utterances { if (hexo-config('utterances.enable')) {
max-width: unset; .utterances {
max-width: unset;
}
} }

View File

@ -1,22 +1,24 @@
.book-mark-link { if (hexo-config('bookmark.enable')) {
border-bottom: 0; .book-mark-link {
position: fixed; border-bottom: 0;
top: -10px; position: fixed;
transition: top .3s; top: -10px;
sidebar-toggle-position(true); transition: top .3s;
sidebar-toggle-position(true);
+tablet-mobile() { +tablet-mobile() {
display: none; display: none;
}
&::before {
color: unquote(hexo-config('bookmark.color'));
font-size: 32px;
line-height: 1;
font-family-icons('\f02e');
}
} }
&::before { .book-mark-link:hover, .book-mark-link-fixed {
color: unquote(hexo-config('bookmark.color')); top: -2px;
font-size: 32px;
line-height: 1;
font-family-icons('\f02e');
} }
} }
.book-mark-link:hover, .book-mark-link-fixed {
top: -2px;
}

View File

@ -1,58 +1,60 @@
@keyframes octocat-wave { if (hexo-config('github_banner.enable')) {
0%, 100% { @keyframes octocat-wave {
transform: rotate(0); 0%, 100% {
transform: rotate(0);
}
20%, 60% {
transform: rotate(-25deg);
}
40%, 80% {
transform: rotate(10deg);
}
} }
20%, 60% { .github-corner {
transform: rotate(-25deg); $bg-color = unquote(hexo-config('android_chrome_color'));
}
40%, 80% { :hover .octo-arm {
transform: rotate(10deg); animation: octocat-wave 560ms ease-in-out;
}
}
.github-corner {
$bg-color = unquote(hexo-config('android_chrome_color'));
:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out;
}
svg {
color: white;
fill: $bg-color;
position: absolute;
right: 0;
top: 0;
z-index: $zindex-0;
}
+tablet-mobile() {
if (hexo-config('local_search.enable') or hexo-config('algolia_search.enable')) {
display: none;
} }
svg { svg {
if (($scheme == 'Pisces') or ($scheme == 'Gemini')) { color: white;
color: $bg-color; fill: $bg-color;
fill: white; position: absolute;
right: 0;
top: 0;
z-index: $zindex-0;
}
+tablet-mobile() {
if (hexo-config('local_search.enable') or hexo-config('algolia_search.enable')) {
display: none;
}
svg {
if (($scheme == 'Pisces') or ($scheme == 'Gemini')) {
color: $bg-color;
fill: white;
}
}
.github-corner:hover .octo-arm {
animation: none;
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out;
} }
} }
.github-corner:hover .octo-arm { if ($scheme == 'Mist') {
animation: none; +mobile() {
} svg {
top: inherit;
.github-corner .octo-arm { }
animation: octocat-wave 560ms ease-in-out;
}
}
if ($scheme == 'Mist') {
+mobile() {
svg {
top: inherit;
} }
} }
} }

View File

@ -33,6 +33,5 @@
@import 'site-nav'; @import 'site-nav';
@import 'menu'; @import 'menu';
@import 'bookmark' if (hexo-config('bookmark.enable')); @import 'bookmark';
@import 'github-banner';
@import 'github-banner' if (hexo-config('github_banner.enable'));

View File

@ -2,4 +2,4 @@
@import 'sidebar'; @import 'sidebar';
@import 'footer'; @import 'footer';
@import 'mobile' if (hexo-config('mobile_layout_economy')); @import 'mobile';

View File

@ -5,77 +5,78 @@
} }
*/ */
+mobile-small() { if (hexo-config('mobile_layout_economy')) {
// For Pisces & Gemini schemes only wider width (remove main blocks in Gemini). +mobile-small() {
.main-inner { // For Pisces & Gemini schemes only wider width (remove main blocks in Gemini).
padding: initial !important; .main-inner {
} padding: initial !important;
// For all schemes wider width.
.posts-expand {
.post-header {
margin-bottom: 10px !important;
}
}
.post-block {
margin-top: initial !important;
// Inside posts blocks content padding (default 40px).
padding: $content-mobile-padding 18px $content-mobile-padding !important;
}
.post-body {
// For headers narrow width.
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 8px;
} }
// Rewrite paddings & margins inside tags. // For all schemes wider width.
.note, .tabs .tab-content .tab-pane { .posts-expand {
h1, h2, h3, h4, h5, h6 { .post-header {
margin: 0 5px; margin-bottom: 10px !important;
} }
} }
// For paragraphs narrow width. .post-block {
> p { margin-top: initial !important;
margin: 0 0 10px; // Inside posts blocks content padding (default 40px).
padding: $content-mobile-padding 18px $content-mobile-padding !important;
} }
// Rewrite paddings & margins inside tags. .post-body {
.note > p, .tabs .tab-content .tab-pane > p { // For headers narrow width.
padding: 0 5px; h1, h2, h3, h4, h5, h6 {
} margin: 20px 0 8px;
}
img, video { // Rewrite paddings & margins inside tags.
margin-bottom: 10px !important; .note, .tabs .tab-content .tab-pane {
} h1, h2, h3, h4, h5, h6 {
margin: 0 5px;
.note {
margin-bottom: 10px !important;
padding: 10px !important;
if (hexo-config('note.icons')) {
&:not(.no-icon) {
padding-left: 35px !important;
} }
} }
// For paragraphs narrow width.
> p {
margin: 0 0 10px;
}
// Rewrite paddings & margins inside tags.
.note > p, .tabs .tab-content .tab-pane > p {
padding: 0 5px;
}
img, video {
margin-bottom: 10px !important;
}
.note {
margin-bottom: 10px !important;
padding: 10px !important;
if (hexo-config('note.icons')) {
&:not(.no-icon) {
padding-left: 35px !important;
}
}
}
.tabs .tab-content .tab-pane {
padding: 10px 10px 0 !important;
}
} }
.tabs .tab-content .tab-pane { .post-eof {
padding: 10px 10px 0 !important; margin: 40px auto 20px !important;
} }
}
.post-eof { .pagination {
margin: 40px auto 20px !important; margin-top: 40px;
} }
.pagination {
margin-top: 40px;
} }
} }
/* /*
// < 413px // < 413px
+mobile-smallest() { +mobile-smallest() {

View File

@ -34,7 +34,5 @@
@import 'sidebar-dimmer'; @import 'sidebar-dimmer';
@import 'sidebar-nav'; @import 'sidebar-nav';
@import 'sidebar-toggle'; @import 'sidebar-toggle';
@import 'sidebar-toc';
@import 'sidebar-toc' if (hexo-config('toc.enable')); @import 'site-state';
@import 'site-state' if (hexo-config('site_state'));

View File

@ -1,59 +1,61 @@
.post-toc { if (hexo-config('toc.enable')) {
font-size: $font-size-small; .post-toc {
font-size: $font-size-small;
ol { ol {
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0 2px 5px 10px; padding: 0 2px 5px 10px;
text-align: left; text-align: left;
> ol { > ol {
padding-left: 0; padding-left: 0;
} }
a { a {
transition: all $transition-ease; transition: all $transition-ease;
}
}
.nav-item {
line-height: 1.8;
overflow: hidden;
text-overflow: ellipsis;
if (not hexo-config('toc.wrap')) {
white-space: nowrap;
}
}
.nav {
.nav-child {
display: hexo-config('toc.expand_all') ? block : none;
}
.active > .nav-child {
display: block;
}
.active-current > .nav-child {
display: block;
> .nav-item {
display: block;
} }
} }
.active > a { .nav-item {
border-bottom-color: $sidebar-highlight; line-height: 1.8;
color: $sidebar-highlight; overflow: hidden;
text-overflow: ellipsis;
if (not hexo-config('toc.wrap')) {
white-space: nowrap;
}
} }
.active-current > a { .nav {
color: $sidebar-highlight; .nav-child {
display: hexo-config('toc.expand_all') ? block : none;
}
&:hover { .active > .nav-child {
display: block;
}
.active-current > .nav-child {
display: block;
> .nav-item {
display: block;
}
}
.active > a {
border-bottom-color: $sidebar-highlight;
color: $sidebar-highlight; color: $sidebar-highlight;
} }
.active-current > a {
color: $sidebar-highlight;
&:hover {
color: $sidebar-highlight;
}
}
} }
} }
} }

View File

@ -1,26 +1,28 @@
.site-state { if (hexo-config('site_state')) {
flex-wrap(); .site-state {
line-height: 1.4; flex-wrap();
} line-height: 1.4;
}
.site-state-item { .site-state-item {
// Fix issue #103 // Fix issue #103
// The click area of the link becomes smaller // The click area of the link becomes smaller
padding: 0 15px; padding: 0 15px;
a { a {
border-bottom: 0; border-bottom: 0;
display: block;
}
}
.site-state-item-count {
display: block; display: block;
font-size: $site-state-item-count-font-size;
font-weight: 600;
}
.site-state-item-name {
color: $site-state-item-name-color;
font-size: $site-state-item-name-font-size;
} }
} }
.site-state-item-count {
display: block;
font-size: $site-state-item-count-font-size;
font-weight: 600;
}
.site-state-item-name {
color: $site-state-item-name-color;
font-size: $site-state-item-name-font-size;
}

View File

@ -2,10 +2,7 @@
@import 'group-pictures'; @import 'group-pictures';
@import 'label'; @import 'label';
@import 'link-grid'; @import 'link-grid';
@import 'mermaid';
@import 'note';
@import 'pdf';
@import 'tabs'; @import 'tabs';
@import 'note' if (hexo-config('note.style') != 'disabled');
@import 'pdf' if (hexo-config('pdf.enable'));
@import 'mermaid' if (hexo-config('mermaid.enable'));

View File

@ -1,4 +1,6 @@
.mermaid { if (hexo-config('mermaid.enable')) {
margin-bottom: 20px; .mermaid {
text-align: center; margin-bottom: 20px;
text-align: center;
}
} }

View File

@ -1,109 +1,111 @@
.post-body .note { if (hexo-config('note.style') != 'disabled') {
$note-icons = hexo-config('note.icons'); .post-body .note {
$note-style = hexo-config('note.style'); $note-icons = hexo-config('note.icons');
$note-style = hexo-config('note.style');
border-radius: $note-border-radius; border-radius: $note-border-radius;
margin-bottom: 20px; margin-bottom: 20px;
padding: 1em; padding: 1em;
position: relative; position: relative;
if ($note-style == 'simple') { if ($note-style == 'simple') {
border: 1px solid $gainsboro; border: 1px solid $gainsboro;
border-left-width: 5px; border-left-width: 5px;
}
if ($note-style == 'modern') {
background: $whitesmoke;
border: 1px solid transparent;
}
if ($note-style == 'flat') {
background: lighten($gainsboro, 65%);
border: initial;
border-left: 3px solid $gainsboro;
}
summary {
cursor: pointer;
outline: 0;
p {
display: inline;
}
}
h2, h3, h4, h5, h6 {
border-bottom: initial;
margin: 0;
padding-top: 0;
}
p, ul, ol, table, pre, blockquote, img {
&:first-child {
margin-top: 0;
} }
&:last-child { if ($note-style == 'modern') {
margin-bottom: 0; background: $whitesmoke;
border: 1px solid transparent;
} }
}
if ($note-icons) { if ($note-style == 'flat') {
&:not(.no-icon) { background: lighten($gainsboro, 65%);
padding-left: 2.5em; border: initial;
border-left: 3px solid $gainsboro;
}
&::before { summary {
font-size: 1.5em; cursor: pointer;
left: .3em; outline: 0;
position: absolute;
top: calc(50% - 1em); p {
display: inline;
} }
} }
}
for $type in $note-types { h2, h3, h4, h5, h6 {
&.{$type} { border-bottom: initial;
if ($note-style == 'flat') { margin: 0;
background: $note-bg[$type]; padding-top: 0;
if (hexo-config('darkmode')) { }
@media (prefers-color-scheme: dark) {
background: mix($note-bg[$type], $body-bg-color-dark, 10%); p, ul, ol, table, pre, blockquote, img {
} &:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
if ($note-icons) {
&:not(.no-icon) {
padding-left: 2.5em;
&::before {
font-size: 1.5em;
left: .3em;
position: absolute;
top: calc(50% - 1em);
} }
} }
}
if ($note-style == 'modern') { for $type in $note-types {
background: $note-modern-bg[$type]; &.{$type} {
border-color: $note-modern-border[$type]; if ($note-style == 'flat') {
color: $note-modern-text[$type]; background: $note-bg[$type];
if (hexo-config('darkmode')) {
@media (prefers-color-scheme: dark) {
background: mix($note-bg[$type], $body-bg-color-dark, 10%);
}
}
}
a:not(.btn) { if ($note-style == 'modern') {
border-bottom-color: $note-modern-text[$type]; background: $note-modern-bg[$type];
border-color: $note-modern-border[$type];
color: $note-modern-text[$type]; color: $note-modern-text[$type];
&:hover { a:not(.btn) {
border-bottom-color: $note-modern-hover[$type]; border-bottom-color: $note-modern-text[$type];
color: $note-modern-hover[$type]; color: $note-modern-text[$type];
&:hover {
border-bottom-color: $note-modern-hover[$type];
color: $note-modern-hover[$type];
}
} }
} }
}
if ($note-style != 'modern') { if ($note-style != 'modern') {
border-left-color: $note-border[$type]; border-left-color: $note-border[$type];
h2, h3, h4, h5, h6 { h2, h3, h4, h5, h6 {
color: $note-text[$type];
}
}
if ($note-icons) {
&:not(.no-icon)::before {
font-family-icons($note-icon[$type]);
if ($note-style != 'modern') {
color: $note-text[$type]; color: $note-text[$type];
} }
} }
if ($note-icons) {
&:not(.no-icon)::before {
font-family-icons($note-icon[$type]);
if ($note-style != 'modern') {
color: $note-text[$type];
}
}
}
} }
} }
} }

View File

@ -1,6 +1,8 @@
.pdfobject-container { if (hexo-config('pdf.enable')) {
iframe, embed { .pdfobject-container {
height: unquote(hexo-config('pdf.height')); iframe, embed {
width: 100%; height: unquote(hexo-config('pdf.height'));
width: 100%;
}
} }
} }