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

View File

@ -1,12 +1,12 @@
.floating-yuriko { .floating-yuriko {
position: fixed; position: fixed;
right: 1rem; right: 1rem;
bottom: 1rem; bottom: 1rem;
margin-bottom: 0px; margin-bottom: 0px;
cursor: pointer; cursor: pointer;
img { &__image {
height: 20vh; height: 20vh;
} }
} }
.hvr-float { .hvr-float {
@ -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

@ -1,38 +1,38 @@
.game-item { .game-item {
padding: 0.25rem 1rem; padding: 0.25rem 1rem;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@include transition; @include transition;
@include screen(lg) {
flex-direction: row;
}
&:hover {
background-color: var(--highlight-bg-color);
}
&__title {
flex-grow: 1;
}
&__caption {
font-size: $text-2xl;
@include my(0.25rem);
}
&__content {
@include my(0.5rem);
display: block;
p { @include screen(lg) {
@include my(0.25rem); flex-direction: row;
white-space: nowrap; }
text-align: right; &:hover {
} background-color: var(--highlight-bg-color);
flex-shrink: 1; }
}
&__icon { &__title {
padding: 0.5rem; flex-grow: 1;
vertical-align: middle; }
} &__caption {
} font-size: $text-2xl;
@include my(0.25rem);
}
&__content {
@include my(0.5rem);
display: block;
flex-shrink: 1;
}
&__text {
@include my(0.25rem);
white-space: nowrap;
text-align: right;
}
&__icon {
padding: 0.5rem;
vertical-align: middle;
}
}

View File

@ -60,23 +60,22 @@
} }
&__title { &__title {
display: flex;
flex-direction: row;
align-items: center;
@include py(0.5rem);
@include screen(md) {
@include py(1rem);
}
color: $white;
font-size: $text-lg;
padding-left: 1rem;
height: 100%;
flex-grow: 1; flex-grow: 1;
@include transition; @include transition;
a {
display: flex;
flex-direction: row;
align-items: center;
@include py(0.5rem);
@include screen(md) {
@include py(1rem);
}
color: $white;
font-size: $text-lg;
padding-left: 1rem;
height: 100%;
}
&:hover { &:hover {
background-color: $theme-blue; background-color: $theme-blue;
text-decoration: none;
} }
} }
@ -89,18 +88,18 @@
cursor: pointer; cursor: pointer;
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
@include transition; @include transition;
&:hover { &:hover {
background-color: $theme-blue; background-color: $theme-blue;
} }
p { }
color: $white; &__nav-button-text {
margin-right: 0.5rem; color: $white;
display: none; margin-right: 0.5rem;
@include screen(md) { display: none;
display: block; @include screen(md) {
} display: block;
} }
} }
&__icon { &__icon {

View File

@ -1,24 +1,23 @@
.media-item { .media-item {
padding: 0.25rem 1rem; padding: 0.25rem 1rem;
width: 100%;
@include transition;
&:hover {
background-color: var(--highlight-bg-color);
}
&__caption {
font-size: $text-2xl;
@include my(0.25rem);
}
&__content {
width: 100%; width: 100%;
@include transition; @include my(0.5rem);
display: block;
&:hover { }
background-color: var(--highlight-bg-color); &__text {
} @include my(0.25rem);
}
&__caption { }
font-size: $text-2xl;
@include my(0.25rem);
}
&__content {
width: 100%;
@include my(0.5rem);
display: block;
p {
@include my(0.25rem);
}
}
}

View File

@ -14,32 +14,33 @@
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
@include transition; @include transition;
&: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;
color: $white; color: $white;
text-align: center; text-align: center;
@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;
@include px(1rem); color: $white;
} @include px(1rem);
} }
&__separator { &__separator {
margin-left: 5rem; margin-left: 5rem;

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,13 +18,13 @@
min-width: 300px; min-width: 300px;
max-width: 450px; max-width: 450px;
} }
img { }
position: absolute; &__image-inner {
left: 0; position: absolute;
top: 0; left: 0;
width: 100%; top: 0;
height: 100%; width: 100%;
} height: 100%;
} }
&__image::after { &__image::after {
display: block; display: block;
@ -36,7 +36,7 @@
padding-left: 1rem; padding-left: 1rem;
} }
} }
&__tag-row { &__tag-row {
padding-top: 1rem; padding-top: 1rem;
@include screen(md) { @include screen(md) {
@ -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,30 +101,22 @@
&__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 { &__author-image {
border-radius: 9999px; border-radius: 9999px;
height: 100%; 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;
margin-bottom: 1rem; margin-bottom: 1rem;
font-size: $text-sm; font-size: $text-sm;
} }
} }

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 {
display: flex;
flex-direction: row;
align-items: center;
}
&--tag-text {
margin-left: 0.5rem;
color: $white;
}
&--tag-color {
display: inline-block;
border-radius: 9999px;
vertical-align: text-bottom;
height: 4rem;
width: 4rem;
}
} }
&__tag-row { &__tag-row {
padding-top: 1rem; padding-top: 1rem;
@include screen(md) { @include screen(md) {
padding-top: 0; padding-top: 0;
} }
* {
display: inline-block;
padding-right: 0.25rem;
}
} }
&__tag-info {
&__tag-heading {
display: flex;
flex-direction: row;
h1 {
margin-left: 0.5rem;
}
}
&__tag-heading-color {
display: inline-block; display: inline-block;
border-radius: 9999px; padding-right: 0.25rem;
vertical-align: text-bottom;
height: 4rem;
width: 4rem;
}
&__tag-color {
display: inline-block;
border-radius: 9999px;
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 { &__author-image {
border-radius: 9999px; border-radius: 9999px;
height: 100%; 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 { &__author-name {
text-decoration: underline; 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);
}
}