Rewrite styles with SCSS.

This commit is contained in:
Cotes Chung 2020-02-25 17:56:03 +08:00
parent f353c7a97b
commit 73d1027acc
10 changed files with 1165 additions and 1104 deletions

View File

@ -47,6 +47,19 @@
--footnote-target-bg: rgb(63, 81, 181);
--btn-sharing: #6c757d;
/* tags */
--tag-border: rgb(59, 79, 88);
--tag-shadow: rgb(32, 33, 33);
/* categories */
--categories-hover-bg: rgb(73, 75, 76);
/* archives */
--timeline-node-bg: rgb(150, 152, 156);
/* Footer */
---footer-link: rgb(146, 146, 146);
hr {
border-color: var(--main-border);
}
@ -68,40 +81,29 @@
background-color: var(--card-bg);
}
.categories .card-header {
.categories {
.card-header {
background-color: var(--card-header-bg);
}
.categories .list-group-item {
.list-group-item {
// @extend %category-bg;
border-left: none;
border-right: none;
padding-left: 2rem;
border-color: var(--main-border);
}
.categories .list-group-item:last-child {
&:last-child {
border-bottom-color: var(--card-bg);
}
}
}
/* tags */
--tag-border: rgb(59, 79, 88);
--tag-shadow: rgb(32, 33, 33);
/* categories */
--categories-hover-bg: rgb(73, 75, 76);
/* archives */
--timeline-node-bg: rgb(150, 152, 156);
#archives li:nth-child(odd) {
background-image: linear-gradient(to left,
rgb(26, 26, 30), rgb(39, 39, 45), rgb(39, 39, 45), rgb(39, 39, 45), rgb(26, 26, 30));
}
/* Footer */
---footer-link: rgb(146, 146, 146);
}
} // dark-scheme
@mixin light-mode-invisible {

84
assets/css/_module.scss Normal file
View File

@ -0,0 +1,84 @@
/*
* Mainly scss modules, only imported to `assets/css/main.scss`
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/*---------- scss placeholder ---------*/
%tag-hover {
background: var(--tag-hover, rgb(222, 226, 230));
transition: background 0.35s ease-in-out;
}
%table-cell {
padding: .35rem .8rem;
font-size: 95%;
}
%link-hover {
color: #d2603a!important;
border-bottom: 1px solid #d2603a;
text-decoration: none;
}
%link-color {
color: var(--link-color, #2a408e);
}
%no-bottom-border {
border-bottom: none;
}
%section {
line-height: 1.2;
margin-bottom: 1rem;
}
%anchor {
padding-top: 3.5rem;
margin-top: -2.5rem;
}
%footer-content {
font-weight: 600;
color: var(---footer-link, inherit);
}
/*---------- scss mixin ---------*/
@mixin no-text-decoration {
text-decoration: none;
}
@mixin sidebar-icon {
color: rgba(255, 255, 255, 0.5);
transition: color 0.35s ease-in-out;
user-select: none;
margin: 0 .25rem;
}
@mixin icon-round($diameter) {
border: 1px solid;
border-radius: 50%;
width: $diameter;
height: $diameter;
}
@mixin ml-mr($value) {
margin-left: $value;
margin-right: $value;
}
@mixin pl-pr($val) {
padding-left: $val;
padding-right: $val;
}
@mixin input-placeholder {
opacity: 0.6;
}

View File

@ -8,43 +8,50 @@
MIT License
*/
$dot-color: #c2c6cc;
%date-timeline {
content: "";
width: 4px;
left: 75px;
display: inline-block;
float: left;
position: relative;
background-color: var(--main-border, rgba(0, 0, 0, 0.075));
}
#archives {
letter-spacing: 0.03rem;
}
#archives li {
li {
font-size: 1.1rem;
line-height: 3rem;
}
#archives li:nth-child(odd) {
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
#archives li>div {
>div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
#archives span.lead {
span.lead {
font-size: 1.5rem;
font-family: 'Oswald', sans-serif;
position: relative;
left: 8px;
}
#archives span.lead:not(:first-child) {
&:not(:first-child) {
position: relative;
left: 4px;
}
#archives span.lead:not(:first-child)::after {
&::after {
left: 67px;
}
}
#archives span.lead::after { /* Year dot */
&::after {
/* Year dot */
content: "";
display: block;
position: relative;
@ -57,40 +64,20 @@
left: 63px;
border: 3px solid;
background-color: var(--main-border, #ffffff);
border-color: var(--timeline-node-bg, #c2c6cc);
box-shadow: 0 0 2px 0 #c2c6cc;
border-color: var(--timeline-node-bg, $dot-color);
box-shadow: 0 0 2px 0 $dot-color;
z-index: 1;
}
} // #archives span.lead
#archives .date {
.date {
white-space: nowrap;
display: inline-block;
}
#archives .date.month {
&.month {
width: 1.4rem;
text-align: center;
font-family: 'Oswald', sans-serif;
}
#archives .date.day {
font-size: 85%;
font-family: sans-serif;
text-align: center;
margin-right: -2px;
width: 1.2rem;
position: relative;
left: -.15rem;
}
#archives ul>li>div>a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: .1rem;
}
#archives .date.month ~ a::before {
~a::before {
/* A dot for Month and Day */
content: "";
display: inline-block;
@ -103,47 +90,57 @@
float: left;
top: 1.35rem;
left: 69px;
background-color: var(--timeline-node-bg, #c2c6cc);
box-shadow: 0 0 3px 0 #c2c6cc;
background-color: var(--timeline-node-bg, $dot-color);
box-shadow: 0 0 3px 0 $dot-color;
z-index: 1;
}
/* timeline for date */
#archives ul>li::after,
#archives ul>li:first-child::before {
content: "";
width: 4px;
left: 75px;
display: inline-block;
float: left;
position: relative;
background-color: var(--main-border, rgba(0, 0, 0, 0.075));
}
&.day {
font-size: 85%;
font-family: sans-serif;
text-align: center;
margin-right: -2px;
width: 1.2rem;
position: relative;
left: -.15rem;
}
} // #archives .date
#archives ul>li::after {
ul {
>li {
>div>a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: .1rem;
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
#archives ul>li:first-child::before {
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
#archives ul:not(:last-child)>li:last-child::after {
}
&:not(:last-child)>li:last-child::after {
height: 3.4rem;
}
#archives ul:last-child>li:last-child::after {
&:last-child>li:last-child::after {
display: none;
}
} // #archives ul
} // #archives
@media all and (max-width: 576px) {
#archives {
margin-top: -1rem;
}
#archives ul {
ul {
letter-spacing: 0;
}
}
}

View File

@ -8,42 +8,56 @@
MIT License
*/
.categories {
margin-bottom: 2rem;
}
.categories .card-header {
padding-right: 12px;
}
.categories .card-header>span>i:first-child,
.categories .list-group-item>i {
%category-icon-color {
color: gray;
}
.categories .list-group-item {
.categories {
margin-bottom: 2rem;
.card-header {
padding-right: 12px;
}
.list-group-item {
border-left: none;
border-right: none;
padding-left: 2rem;
}
.categories .collapsing .list-group-item:first-child,
.categories .collapse .list-group-item:first-child {
.card-header>span>i:first-child {
@extend %category-icon-color;
}
.list-group-item {
>i {
@extend %category-icon-color;
}
.collapsing &:first-child,
.collapse &:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.categories i.far,
.categories i.fas { // fontawesome icons
font-size: 86%;
}
i {
&.far, &.fas {
font-size: 86%; // fontawesome icons
}
}
} // .categories
.category-trigger {
width: 1.7rem;
height: 1.7rem;
border-radius: 50%;
text-align: center;
color: #6c757d!important;
>i.fas {
position: relative;
height: .7rem;
width: 1rem;
transition: 300ms ease all;
}
}
@media (hover: hover) { // only works on desktop
@ -52,13 +66,6 @@
}
}
.category-trigger>i.fas {
position: relative;
height: .7rem;
width: 1rem;
transition: 300ms ease all;
}
.rotate {
-ms-transform: rotate(-90deg); /* IE 9 */
-webkit-transform: rotate(-90deg); /* Safari 3-8 */

View File

@ -8,14 +8,11 @@
MIT License
*/
#page-category ul>li,
#page-tag ul>li {
#page-category, #page-tag {
ul>li {
line-height: 1.5rem;
padding: .6rem 0;
}
#page-category ul>li::before,
#page-tag ul>li::before {
&::before { // dot
background: #999;
width: 5px;
height: 5px;
@ -26,16 +23,15 @@
top: .6rem;
margin-right: .5rem;
}
#page-tag ul>li>a,
#page-category ul>li>a, { /* post's title */
>a { /* post's title */
font-size: 1.1rem;
}
#page-category ul>li>span:last-child,
#page-tag ul>li>span:last-child { /* post's date */
>span:last-child {
white-space: nowrap;
}
/* post's date */
}
}
#page-tag h1>i { // tag icon
font-size: 1.2rem;
@ -45,11 +41,13 @@
font-size: 1.25rem;
}
#page-category a:hover,
#page-tag a:hover,
#access-lastmod a:hover {
a:hover {
#page-category &,
#page-tag &,
#access-lastmod & {
margin-bottom: -1px; // Avoid jumping
}
}
.dash {
margin: 0 .5rem .6rem .5rem;
@ -57,17 +55,16 @@
}
@media all and (max-width: 576px) {
#page-category ul>li::before,
#page-tag ul>li::before {
#page-category, #page-tag {
ul>li {
&::before {
margin: 0 .5rem;
}
#page-tag ul>li>a,
#page-category ul>li>a {
>a {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}

View File

@ -1,6 +1,5 @@
---
---
/*!
Style for Homepage
v2.0
@ -12,40 +11,36 @@
#post-list {
margin-top: 1rem;
padding-right: .5rem;
.post-meta {
i:not(:first-child) { // post-meta icons on HOME
margin-left: 1.5rem;
}
}
}
.pagination {
font-size: 1rem;
}
.pagination a:hover {
a:hover {
text-decoration: none;
}
}
.post-preview {
padding-top: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid rgba(158, 158, 158, 0.17);
}
.post-preview>h1 {
>h1 {
font-size: 1.4rem;
margin: 0;
}
.post-preview i.far {
/* fontawesome icons */
i.far { /* fontawesome icons */
font-size: 86%;
}
.post-preview .post-content {
.post-content {
margin-top: .6rem;
margin-bottom: .6rem;
color: var(--text-color, dimgray);
}
/* Make preview shorter in Home page*/
.post-preview .post-content>p {
>p { /* Make preview shorter in Home page*/
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
@ -53,8 +48,11 @@
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
}
.page-item .page-link {
.page-item {
.page-link {
color: var(--text-color, #555555);
width: 2.5rem;
height: 2.5rem;
@ -71,36 +69,32 @@
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
}
.page-item.active .page-link {
&.active {
.page-link {
background-color: var(--btn-active-bg, #2a408e);
border-color: var(--btn-active-border-color, #007bff);
box-shadow: 0 0 8px 0 var(--main-wrapper-bg, #4b92d2) !important;
color: var(--text-color, #f8f8f8);
}
.page-item.disabled .page-link {
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--main-border, #f1f1f1);
background-color: var(--button-bg);
}
.page-item.disabled {
cursor: not-allowed;
}
.page-item:first-child .page-link,
.page-item:last-child .page-link {
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
.page-item:not(:last-child) {
&:not(:last-child) {
margin-right: 0.6rem;
}
#post-list .post-meta i:not(:first-child) { // post-meta icons on HOME
margin-left: 1.5rem;
}
} // .page-item
@media all and (max-width: 576px) {
#post-list .post-meta>span i:not(:first-child) {

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,20 @@
$prompt-older: "{{ site.data.label.post.button.previous }}";
$prompt-newer: "{{ site.data.label.post.button.next }}";
@mixin btn-sharing-color($light-color, $important: false) {
@if $important {
color: var(--btn-sharing, $light-color)!important;
} @else {
color: var(--btn-sharing, $light-color);
}
}
@mixin btn-post-nav {
width: 50%;
position: relative;
border-color: var(--main-border, #e9ecef);
}
.post img {
margin-top: .5rem;
margin-bottom: 1.5rem;
@ -34,38 +48,28 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
padding-top: 3rem;
padding-bottom: 2rem;
@mixin post-nav-btn {
width: 50%;
position: relative;
border-color: var(--main-border, #e9ecef);
}
.btn {
@include post-nav-btn;
@include btn-post-nav;
color: var(--link-color, #2a408e);
}
.btn:hover {
&:hover {
background: #2a408e;
color: #fff;
border-color: #2a408e;
}
.btn.disabled {
@include post-nav-btn;
&.disabled {
@include btn-post-nav;
pointer-events: auto;
cursor: not-allowed;
background: none;
color: gray;
}
.btn.disabled:hover {
&:hover {
border-color: none;
}
.btn.btn-outline-primary.disabled:focus {
}
&.btn-outline-primary.disabled:focus {
box-shadow: none;
}
}
p {
font-size: 1.1rem;
@ -74,38 +78,30 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
white-space: normal;
}
a::before,
span::before {
a, span {
&::before {
color: var(--text-muted-color, gray);
font-size: .65rem;
text-transform: uppercase;
}
a:first-child,
span:first-child {
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
left: .5px;
&::before {
content: $prompt-older
}
a:last-child,
span:last-child {
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: .5px;
}
a:first-child::before,
span:first-child::before {
content: $prompt-older
}
a:last-child::before,
span:last-child::before {
&::before {
content: $prompt-newer
}
}
}
} // .post-navigation
@keyframes fade-up {
from {
@ -127,17 +123,15 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
top: 2rem;
transition: top 0.2s ease-in-out;
animation: fade-up .8s;
}
#toc-wrapper.topbar-down {
&.topbar-down {
top: 6rem;
}
#toc-wrapper>h3 {
>h3 {
font-size: 1rem;
font-family: 'Oswald', sans-serif;
color: gray;
}
}
#toc li>a {
line-height: 1rem;
@ -148,13 +142,12 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
/*--- Related Posts ---*/
#related-posts > h3 {
#related-posts {
>h3 {
color: gray;
font-size: 1.1rem;
font-family: 'Oswald', sans-serif;
}
#related-posts {
.card {
border: 1px solid var(--main-wrapper-bg, #f1f1f1);
background-color: var(--card-bg);
@ -165,13 +158,12 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
h3 {
color: var(--relate-post-title, #353a3d);
}
}
.card:hover {
&:hover {
-webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0);
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
}
}
.timeago {
color: var(--text-muted-color, rgba(30, 55, 70, .4));
@ -194,9 +186,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
ul {
list-style-type: none;
padding-inline-start: 1.5rem;
}
ul>li::before {
>li::before {
background: #c2c9d4;
width: 5px;
height: 5px;
@ -208,6 +198,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
right: 1rem;
}
}
}
#post-extend-wrapper {
min-height: 2rem;
@ -223,32 +214,31 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
a:hover,
i:hover {
@include btn-sharing-color(#2a408e, true);
text-decoration: none;
color: var(--link-color, #2a408e)!important;
}
.share-icon {
font-size: 1.2rem;
.fab.fa-twitter {
color: var(--btn-sharing, rgba(29, 161, 242, 1.00));
.fab {
&.fa-twitter {
@include btn-sharing-color(rgba(29, 161, 242, 1.00));
}
.fab.fa-facebook-square {
color: var(--btn-sharing, rgb(66, 95, 156));
&.fa-facebook-square {
@include btn-sharing-color(rgb(66, 95, 156));
}
.fab.fa-telegram {
color: var(--btn-sharing, rgb(39, 159, 217));
&.fa-telegram {
@include btn-sharing-color(rgb(39, 159, 217));
}
&.fa-weibo {
@include btn-sharing-color(rgb(229, 20, 43));
}
.fab.fa-weibo {
color: var(--btn-sharing, rgb(229, 20, 43));
}
} // .share-icon
.fas.fa-link {
color: var(--btn-sharing, rgb(171, 171, 171));
@include btn-sharing-color(rgb(171, 171, 171));
}
} // .share-wrapper
@ -256,23 +246,19 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.share-label {
font-family: 'Oswald', sans-serif;
}
.share-label::after {
&::after {
content: ":";
}
}
.license-wrapper {
line-height: 1.2rem;
.license-text>a {
font-weight: 600;
}
i {
font-weight: 400;
}
span:last-child {
font-size: .85rem;
}
@ -283,12 +269,11 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.post-tail-bottom {
-ms-flex-wrap: wrap!important;
flex-wrap: wrap!important;
}
.post-tail-bottom>div:first-child {
>div:first-child {
margin-bottom: 1rem;
}
}
}
@media all and (max-width: 768px) {
.post img {
@ -297,21 +282,24 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
@media all and (min-width: 768px) {
.post .post-meta > div:not(:first-child)::before {
.post {
.post-meta {
>div:not(:first-child)::before {
content: "\2022";
color: rgba(158, 158, 158, 0.8);
font-weight: bold;
padding-left: .5rem;
padding-right: .3rem;
}
.post .post-meta.flex-column {
&.flex-column {
-webkit-box-orient: horizontal!important;
-webkit-box-direction: normal!important;
-ms-flex-direction: row!important;
flex-direction: row!important;
}
}
} // .post
}
@media all and (min-width: 768px) and (max-width: 830px) {
.post img {

View File

@ -77,17 +77,31 @@
/*-- Codes Snippet --*/
div.highlight,
figure.highlight,
.highlighter-rouge {
%highlight-pre-bg {
background: var(--highlight-pre-bg, #f7f7f7)
}
.highlight {
overflow: auto;
%code-snippet-radius {
border-radius: 5px;
}
.highlight .lineno {
.highlighter-rouge {
@extend %highlight-pre-bg;
@extend %code-snippet-radius;
margin-bottom: 1.2em; /* Override BS Inline-code style */
}
.highlight {
@extend %code-snippet-radius;
@at-root div#{&} {
@extend %highlight-pre-bg;
}
@at-root figure#{&} {
@extend %highlight-pre-bg;
}
overflow: auto;
.lineno {
margin: .8rem 0rem;
padding: 0 .5rem;
min-width: 2.2rem;
@ -101,56 +115,46 @@ figure.highlight,
-o-user-select: none;
user-select: none;
}
.highlight table {
table {
padding: 0;
border: 0;
}
.highlight td {
padding: 0;
border: 0;
}
.highlight pre {
margin-bottom: 0;
font-size: .85rem;
line-height: 1.4rem;
word-wrap: normal; /* Fixed Safari overflow-x */
}
.highlight table td pre {
td pre {
overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */
}
/* Override BS Inline-code style */
.highlighter-rouge {
margin-bottom: 1.2em;
}
td {
padding: 0;
border: 0;
}
pre {
margin-bottom: 0;
font-size: .85rem;
line-height: 1.4rem;
word-wrap: normal;
/* Fixed Safari overflow-x */
}
} // .highlight
code {
-webkit-hyphens: none;
-ms-hyphens: none;
-moz-hyphens: none;
hyphens: none;
}
code.highlighter-rouge {
&.highlighter-rouge {
padding: 2px 4px;
margin: 0 .3rem;
border-radius: 4px;
}
}
td.rouge-code {
padding-left: 1rem;
padding-right: 1rem;
}
/* code snippet radius */
.highlighter-rouge,
.highlight {
border-radius: 5px;
}
/* Hide line numbers for defualt, console, and terminal code snippets */
div[class^='highlighter-rouge'] pre.lineno,
@ -171,11 +175,9 @@ div.language-terminal.highlighter-rouge td.rouge-code {
-webkit-box-shadow: inset 0 0 2px #c2c6cc;
box-shadow: inset 0 0 2px #c2c6cc;
}
.highlighter-rouge {
color: black;
}
code.highlighter-rouge {
border: 1px solid #e9ecef;
}

View File

@ -17,14 +17,9 @@
letter-spacing: 0;
border: 1px solid var(--tag-border, #dee2e6) !important;
box-shadow: 0 0 3px 0 var(--tag-shadow, #e9ecef);
}
.tag span {
span {
margin-left: 0.6em;
font-size: 0.7em;
font-family: 'Oswald', sans-serif;
}
a.tag:hover {
text-decoration: none;
}