perf(shian): overhaul styling to minimize CSS processing

BREAKING CHANGE: several styles are rewritten completely for performance reasons. please update accordingly.
This commit is contained in:
Damillora 2021-04-22 20:29:31 +07:00
parent c4540bfe26
commit 2a23ca143f
13 changed files with 269 additions and 275 deletions

View File

@ -19,3 +19,4 @@
@import './components/gameitem'; @import './components/gameitem';
@import './components/copyarea'; @import './components/copyarea';
@import './components/floatingyuriko'; @import './components/floatingyuriko';
@import './components/tag';

View File

@ -58,75 +58,74 @@ body {
.main { .main {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
}
p, p,
h1, h1,
h2, h2,
h3, h3,
h4, h4,
h5, h5,
h6 { h6 {
@include my(1rem); @include my(1rem);
} }
h1, h1,
h2, h2,
h3, h3,
h4, h4,
h5, h5,
h6 { h6 {
font-weight: 300; font-weight: 300;
color: var(--accent-color); color: var(--accent-color);
} }
h1 { h1 {
font-size: $text-4xl; font-size: $text-4xl;
} }
h2 { h2 {
font-size: $text-3xl; font-size: $text-3xl;
} }
h3 { h3 {
font-size: $text-2xl; font-size: $text-2xl;
} }
h4 { h4 {
font-size: $text-xl; font-size: $text-xl;
} }
h5 { h5 {
font-size: $text-lg; font-size: $text-lg;
} }
h6 { h6 {
font-size: $text-base; font-size: $text-base;
} }
a { a {
color: var(--accent-color); color: var(--accent-color);
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
} }
} }
ul { ul {
list-style-type: disc; list-style-type: disc;
li p { li p {
@include my(0rem); @include my(0rem);
} }
} }
ol { ol {
list-style-type: decimal; list-style-type: decimal;
} }
code { code {
background-color: var(--accent-bg-color); background-color: var(--accent-bg-color);
color: var(--accent-color); color: var(--accent-color);
white-space: pre-wrap; white-space: pre-wrap;
} }
blockquote { blockquote {
border-left: 0.5rem solid var(--accent-color); border-left: 0.5rem solid var(--accent-color);
@include my(2rem); @include my(2rem);
padding: 0.5rem 0 0.5rem 2rem; padding: 0.5rem 0 0.5rem 2rem;
} }
pre { pre {
background: var(--accent-bg-color); background: var(--accent-bg-color);
color: var(--accent-color); color: var(--accent-color);
padding: 0.5rem; padding: 0.5rem;
border: 1px solid var(--accent-color); border: 1px solid var(--accent-color);
}
} }
.card-list { .card-list {

View File

@ -4,7 +4,7 @@
bottom: 1rem; bottom: 1rem;
margin-bottom: 0px; margin-bottom: 0px;
cursor: pointer; cursor: pointer;
img { &__image {
height: 20vh; height: 20vh;
} }
} }
@ -22,7 +22,9 @@
-webkit-transition-timing-function: ease-out; -webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out; transition-timing-function: ease-out;
} }
.hvr-float:hover, .hvr-float:focus, .hvr-float:active { .hvr-float:hover,
.hvr-float:focus,
.hvr-float:active {
-webkit-transform: translateY(-8px); -webkit-transform: translateY(-8px);
transform: translateY(-8px); transform: translateY(-8px);
} }

View File

@ -27,15 +27,15 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
&.hidden { &--hidden {
height: 0; height: 0;
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
} }
img {
max-height: 100%;
} }
&__popup-image {
max-height: 100%;
} }
&__exit { &__exit {

View File

@ -24,13 +24,13 @@
@include my(0.5rem); @include my(0.5rem);
display: block; display: block;
p { flex-shrink: 1;
}
&__text {
@include my(0.25rem); @include my(0.25rem);
white-space: nowrap; white-space: nowrap;
text-align: right; text-align: right;
} }
flex-shrink: 1;
}
&__icon { &__icon {
padding: 0.5rem; padding: 0.5rem;
vertical-align: middle; vertical-align: middle;

View File

@ -60,9 +60,6 @@
} }
&__title { &__title {
flex-grow: 1;
@include transition;
a {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
@ -74,9 +71,11 @@
font-size: $text-lg; font-size: $text-lg;
padding-left: 1rem; padding-left: 1rem;
height: 100%; height: 100%;
} flex-grow: 1;
@include transition;
&:hover { &:hover {
background-color: $theme-blue; background-color: $theme-blue;
text-decoration: none;
} }
} }
@ -94,7 +93,8 @@
&:hover { &:hover {
background-color: $theme-blue; background-color: $theme-blue;
} }
p { }
&__nav-button-text {
color: $white; color: $white;
margin-right: 0.5rem; margin-right: 0.5rem;
display: none; display: none;
@ -102,7 +102,6 @@
display: block; display: block;
} }
} }
}
&__icon { &__icon {
width: 3rem; width: 3rem;
color: $white; color: $white;

View File

@ -16,9 +16,8 @@
width: 100%; width: 100%;
@include my(0.5rem); @include my(0.5rem);
display: block; display: block;
}
p { &__text {
@include my(0.25rem); @include my(0.25rem);
} }
}
} }

View File

@ -18,15 +18,16 @@
&:hover { &:hover {
background-color: $theme-blue; background-color: $theme-blue;
} }
}
a { &__link {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
i { &__icon {
display: inline-block; display: inline-block;
width: 4rem; width: 4rem;
height: 3rem; height: 3rem;
@ -35,12 +36,12 @@
@include px(0.5rem); @include px(0.5rem);
@include py(0.75rem); @include py(0.75rem);
} }
p { &__text {
display: inline-block; display: inline-block;
flex-grow: 1; flex-grow: 1;
color: $white;
@include px(1rem); @include px(1rem);
} }
}
&__separator { &__separator {
margin-left: 5rem; margin-left: 5rem;
margin-right: 4rem; margin-right: 4rem;

View File

@ -10,6 +10,13 @@
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
&__heading {
color: $white;
@include my(0.5rem);
}
&__text {
@include my(0.5rem);
}
&__background { &__background {
position: absolute; position: absolute;
top: 0; top: 0;
@ -34,15 +41,6 @@
padding-top: 4rem; padding-top: 4rem;
} }
color: $white; color: $white;
a,
h1,
h2,
h3,
h4,
h5,
h6 {
color: $white;
}
} }
&__icon { &__icon {

View File

@ -18,14 +18,14 @@
min-width: 300px; min-width: 300px;
max-width: 450px; max-width: 450px;
} }
img { }
&__image-inner {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
}
&__image::after { &__image::after {
display: block; display: block;
content: ''; content: '';
@ -74,6 +74,7 @@
color: var(--accent-color); color: var(--accent-color);
font-size: $text-xl; font-size: $text-xl;
font-weight: 300; font-weight: 300;
@include my(0rem);
@include screen(md) { @include screen(md) {
font-size: $text-2xl; font-size: $text-2xl;
@ -84,10 +85,12 @@
} }
&__time { &__time {
@include my(0rem);
font-size: $text-xs; font-size: $text-xs;
} }
&__author-list { &__author-list {
@include my(0rem);
font-size: $text-xs; font-size: $text-xs;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -98,26 +101,18 @@
&__author-images { &__author-images {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
}
&__author-image {
height: 2rem;
margin-left: 0.25rem; margin-left: 0.25rem;
margin-right: 0.75rem; margin-right: 0.75rem;
img {
border-radius: 9999px;
height: 100%;
} }
&__author-image {
border-radius: 9999px;
height: 2rem;
} }
&__author-names { &__author-names {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
justify-content: center; justify-content: center;
a:hover {
text-decoration: underline;
}
} }
&__excerpt { &__excerpt {
margin-top: 0.5rem; margin-top: 0.5rem;

View File

@ -1,65 +1,43 @@
.post-header { .post-header {
h1, &__heading {
h2,
h3,
h4,
h5,
h6,
p {
@include my(0.5rem); @include my(0.5rem);
}
&__tag-row {
padding-top: 1rem;
@include screen(md) {
padding-top: 0;
}
* { &--tag {
display: inline-block;
padding-right: 0.25rem;
}
}
&__tag-heading {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
h1 { align-items: center;
}
&--tag-text {
margin-left: 0.5rem; margin-left: 0.5rem;
color: $white;
} }
} &--tag-color {
&__tag-heading-color {
display: inline-block; display: inline-block;
border-radius: 9999px; border-radius: 9999px;
vertical-align: text-bottom; vertical-align: text-bottom;
height: 4rem; height: 4rem;
width: 4rem; width: 4rem;
} }
}
&__tag-color { &__tag-row {
padding-top: 1rem;
@include screen(md) {
padding-top: 0;
}
}
&__tag-info {
display: inline-block; display: inline-block;
border-radius: 9999px; padding-right: 0.25rem;
vertical-align: text-bottom;
height: 1rem;
width: 1rem;
}
&__tag-name {
font-size: $text-base;
&:hover {
text-decoration: underline;
}
}
&__paywall {
font-size: $text-base;
&:hover {
text-decoration: underline;
}
color: var(--accent-color);
} }
&__time { &__time {
font-size: $text-sm; font-size: $text-sm;
@include my(0.5rem);
}
&__title {
color: $white;
@include my(0.5rem);
} }
&__author-list { &__author-list {
font-size: $text-sm; font-size: $text-sm;
display: flex; display: flex;
@ -71,25 +49,21 @@
&__author-images { &__author-images {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} align-items: center;
&__author-image {
height: 2rem;
margin-left: 0.25rem; margin-left: 0.25rem;
margin-right: 0.75rem; margin-right: 0.75rem;
img {
border-radius: 9999px;
height: 100%;
} }
&__author-image {
border-radius: 9999px;
height: 2rem;
} }
&__author-names { &__author-names {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
justify-content: center; justify-content: center;
a:hover {
text-decoration: underline;
} }
&__author-name {
color: $white;
} }
} }

View File

@ -58,9 +58,6 @@
&__nav-content { &__nav-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
p {
margin: 0;
}
&--previous-post { &--previous-post {
align-items: start; align-items: start;
@ -77,7 +74,11 @@
} }
} }
} }
&__nav-indicator {
margin: 0;
}
&__nav-title { &__nav-title {
margin: 0;
font-size: $text-xl; font-size: $text-xl;
color: var(--accent-color); color: var(--accent-color);
} }

View File

@ -0,0 +1,25 @@
.tag {
&__color {
display: inline-block;
border-radius: 9999px;
vertical-align: text-bottom;
height: 1rem;
width: 1rem;
}
&__name {
font-size: $text-base;
&:hover {
text-decoration: underline;
}
&--post-header {
color: $white;
}
}
&__paywall {
font-size: $text-base;
&:hover {
text-decoration: underline;
}
color: var(--accent-color);
}
}