Refactor styling code

This commit is contained in:
panr 2020-06-20 00:07:59 +02:00
parent 409741f42c
commit 149fb37220
13 changed files with 44 additions and 136 deletions

View file

@ -16,11 +16,7 @@
}
&:not(:last-of-type) {
border-bottom: 1px solid var(--light-border-color);
.dark-theme & {
border-color: var(--dark-border-color);
}
border-bottom: 1px solid var(--border-color);
}
}
@ -32,11 +28,7 @@
}
&:not(:last-of-type) {
border-bottom: 1px solid var(--light-border-color);
.dark-theme & {
border-color: var(--dark-border-color);
}
border-bottom: 1px solid var(--border-color);
}
&-header {
@ -65,11 +57,7 @@
padding: 20px 0;
&:not(:last-of-type) {
border-bottom: 1px solid var(--light-border-color);
.dark-theme & {
border-color: var(--dark-border-color);
}
border-bottom: 1px solid var(--border-color);
}
&-title {

View file

@ -13,7 +13,7 @@ a.button {
justify-content: center;
padding: 8px 18px;
margin-bottom: 5px;
background: var(--light-background-secondary);
background: var(--background-secondary);
text-decoration: none;
text-align: center;
font-weight: 500;
@ -23,24 +23,14 @@ a.button {
cursor: pointer;
outline: none;
.dark-theme & {
background: var(--dark-background-secondary);
color: inherit;
}
/* variants */
&.outline {
background: transparent;
border-color: var(--light-background-secondary);
border-color: var(--background-secondary);
box-shadow: none;
padding: 8px 18px;
.dark-theme & {
border-color: var(--dark-background-secondary);
color: inherit;
}
:hover {
transform: none;
box-shadow: none;
@ -82,10 +72,6 @@ a.read-more:active {
padding: 0;
margin: 20px 0;
font-weight: bold;
.dark-theme & {
background: none;
}
}
.code-toolbar {
@ -98,7 +84,7 @@ a.read-more:active {
justify-content: center;
padding: 3px 8px;
margin-bottom: 5px;
background: var(--light-background-secondary);
background: var(--background-secondary);
text-decoration: none;
text-align: center;
font-size: 13px;
@ -108,10 +94,5 @@ a.read-more:active {
appearance: none;
cursor: pointer;
outline: none;
.dark-theme & {
background: var(--dark-background-secondary);
color: inherit;
}
}
}

View file

@ -38,7 +38,7 @@
position: relative;
display: flex;
justify-content: space-between;
background: hsla(0, 0%, 10%, 10%);
background: var(--background-secondary);
padding: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
@ -46,15 +46,11 @@
min-height: 30px;
margin: 0;
cursor: pointer;
.dark-theme & {
background: hsla(0, 0%, 10%, 40%);
}
}
&__title {
flex: 1;
color: var(--accent);
color: var(--color);
padding: 3px 10px;
text-overflow: ellipsis;
white-space: nowrap;
@ -62,19 +58,15 @@
}
&__language {
background: hsl(0, 0%, 100%);
color: var(--accent);
background: var(--background);
color: var(--color);
border-radius: 10px;
text-transform: uppercase;
padding: 3px 10px;
.dark-theme & {
background: hsla(0, 0%, 100%, 10%);
}
}
&__toggle {
color: var(--accent);
color: var(--color);
font-size: 16px;
padding: 3px 10px;

View file

@ -1,11 +1,7 @@
.footer {
padding: 40px 20px;
flex-grow: 0;
color: var(--light-color-secondary);
.dark-theme & {
color: var(--dark-color-secondary);
}
color: var(--color-secondary);
&__inner {
display: flex;
@ -53,4 +49,3 @@
}
}
}

View file

@ -1,15 +1,11 @@
.header {
background: var(--light-header);
background: var(--header);
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 20px;
.dark-theme & {
background: var(--dark-header);
}
&__right {
display: flex;
flex-direction: row;

View file

@ -15,8 +15,8 @@ body {
font-size: 1rem;
font-weight: 600;
line-height: 1.54;
background-color: var(--light-background);
color: var(--light-color);
background-color: var(--background);
color: var(--color);
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-webkit-overflow-scrolling: touch;
@ -25,11 +25,6 @@ body {
@media (--phone) {
font-size: 1rem;
}
&.dark-theme {
background-color: var(--dark-background);
color: var(--dark-color);
}
}
h1, h2, h3, h4, h5, h6 {
@ -131,16 +126,12 @@ figure {
code {
font-family: Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;
background: var(--light-background-secondary);
background: var(--background-secondary);
padding: 1px 6px;
margin: 0 2px;
border-radius: 5px;
font-size: .9rem;
font-weight: normal;
.dark-theme & {
background: var(--dark-background-secondary);
}
}
pre {
@ -161,10 +152,6 @@ pre {
margin: 0;
padding: 0;
font-size: .9rem;
.dark-theme & {
color: inherit;
}
}
}
@ -210,11 +197,7 @@ table, th, td {
}
th {
background: var(--light-background-secondary);
.dark-theme & {
background: var(--dark-background-secondary);
}
background: var(--background-secondary);
}
ul, ol {
@ -253,12 +236,8 @@ ol ol {
hr {
width: 100%;
border: none;
background: var(--light-border-color);
background: var(--border-color);
height: 1px;
.dark-theme & {
background: var(--dark-border-color);
}
}
.hidden {

View file

@ -1,21 +1,17 @@
@define-mixin menu {
position: absolute;
background: var(--light-header);
background: var(--header);
box-shadow: var(--shadow);
margin: 0;
padding: 5px;
list-style: none;
border-radius: 5px;
z-index: 99;
.dark-theme & {
background: var(--dark-background-secondary);
}
}
.menu {
--shadow-color: rgba(0, 0, 0, .12);
--shadow: 0 8px 20px var(--shadow-color);
--color: rgba(0, 0, 0, .12);
--shadow: 0 8px 20px var(--color);
border-right: 1px solid;
margin-right: 18px;
@ -118,10 +114,6 @@
background: rgba(0, 0, 0, 0.05);
border-radius: 3px;
cursor: pointer;
.dark-theme & {
background: rgba(0, 0, 0, 0.15);
}
}
}
}

View file

@ -11,18 +11,13 @@
text-align: center;
margin: 0 auto;
padding: 5px 10px;
background: var(--light-background);
color: var(--light-color-secondary);
background: var(--background);
color: var(--color-secondary);
font-size: .8rem;
text-transform: uppercase;
text-decoration: none;
letter-spacing: .1em;
z-index: 1;
.dark-theme & {
background: var(--dark-background);
color: var(--dark-color-secondary);
}
}
hr {
@ -52,7 +47,7 @@
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--light-background-secondary);
background: var(--background-secondary);
font-size: 1rem;
font-weight: 600;
border-radius: 8px;
@ -61,10 +56,6 @@
cursor: pointer;
appearance: none;
.dark-theme & {
background: var(--dark-background-secondary);
}
+ .button {
margin-left: 10px;
}

View file

@ -10,11 +10,7 @@
}
&:not(:last-of-type) {
border-bottom: 1px solid var(--light-border-color);
.dark-theme & {
border-color: var(--dark-border-color);
}
border-bottom: 1px solid var(--border-color);
}
&-meta {

View file

@ -19,16 +19,12 @@
margin-bottom: 15px;
&-count {
background: var(--light-background-secondary);
background: var(--background-secondary);
font-size: 12px;
margin-left: 5px;
padding: 2px 10px;
border-radius: 5px;
text-decoration: none;
.dark-theme & {
background: var(--dark-background-secondary);
}
}
}
}

View file

@ -1,25 +1,27 @@
:root {
/* light theme color */
--light-background: #fff;
--light-background-secondary: #eaeaea;
--light-header: #fafafa;
--light-color: #222;
--light-color-secondary: #999;
--light-border-color: #dcdcdc;
/* dark theme colors */
--dark-background: #292a2d;
--dark-background-secondary: #3b3d42;
--dark-header: #252627;
--dark-color: #a9a9b3;
--dark-color-secondary: #73747b;
--dark-border-color: #4a4b50;
--background: #fff;
--background-secondary: #eaeaea;
--header: #fafafa;
--color: #222;
--color-secondary: #999;
--border-color: #dcdcdc;
/* variables for js, must be the same as these in @custom-media queries */
--phoneWidth: (max-width: 684px);
--tabletWidth: (max-width: 900px);
}
body.dark-theme {
/* dark theme colors */
--background: #292a2d;
--background-secondary: #3b3d42;
--header: #252627;
--color: #a9a9b3;
--color-secondary: #73747b;
--border-color: #4a4b50;
}
@custom-media --phone (width < 684px);
@custom-media --tablet (width < 900px);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long