style: optimize global style

This commit is contained in:
XPoet 2020-11-19 11:58:54 +08:00
parent 97e52e516f
commit aac021ff4c
18 changed files with 120 additions and 76 deletions

View File

@ -1,5 +1,5 @@
<div class="first-screen-container"> <div class="first-screen-container flex-center">
<div class="content"> <div class="content flex-center">
<div class="description"> <div class="description">
<%= theme.base_info.description || config.description %> <%= theme.base_info.description || config.description %>
</div> </div>

View File

@ -42,25 +42,29 @@
<div class="article-nav"> <div class="article-nav">
<% if (page.prev) { %> <% if (page.prev) { %>
<div class="article-prev"> <div class="article-prev">
<a class="prev btn" <a class="prev"
rel="prev" rel="prev"
href="<%= url_for(page.prev.path) %>" href="<%= url_for(page.prev.path) %>"
> >
<i class="fa fa-chevron-left"></i> <i class="arrow-icon left flex-center fa fa-chevron-left"></i>
<span class="title flex-center">
<span class="post-nav-title-item"><%= page.prev.title %></span> <span class="post-nav-title-item"><%= page.prev.title %></span>
<span class="post-nav-item"><%= __('prev_posts') %></span> <span class="post-nav-item"><%= __('prev_posts') %></span>
</span>
</a> </a>
</div> </div>
<% } %> <% } %>
<% if (page.next) { %> <% if (page.next) { %>
<div class="article-next"> <div class="article-next">
<a class="next btn" <a class="next"
rel="next" rel="next"
href="<%= url_for(page.next.path) %>" href="<%= url_for(page.next.path) %>"
> >
<span class="title flex-center">
<span class="post-nav-title-item"><%= page.next.title %></span> <span class="post-nav-title-item"><%= page.next.title %></span>
<span class="post-nav-item"><%= __('next_posts') %></span> <span class="post-nav-item"><%= __('next_posts') %></span>
<i class="fa fa-chevron-right"></i> </span>
<i class="arrow-icon right flex-center fa fa-chevron-right"></i>
</a> </a>
</div> </div>
<% } %> <% } %>

View File

@ -3,7 +3,7 @@
<% page.posts.forEach(post => { %> <% page.posts.forEach(post => { %>
<li class="home-article-item"> <li class="home-article-item">
<% if (post.sticky && 0) { %> <% if (post.sticky) { %>
<i class="fa fa-thumb-tack top-icon"></i> <i class="fa fa-thumb-tack top-icon"></i>
<% } %> <% } %>

View File

@ -8,7 +8,7 @@ $article-date-font-size = 1em;
.archive-list-container { .archive-list-container {
.archive-item { .archive-item {
margin-bottom: 58px; margin-bottom: $component-interspace;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;

View File

@ -11,11 +11,11 @@ if (hexo-config('comment.valine.enable') && hexo-config('comment.gitalk.enable')
} }
.comments-container { .comments-container {
display: inline-block;
margin-top: $component-interspace; margin-top: $component-interspace;
#comment-anchor { #comment-anchor {
width: 100%; width: 100%;
height: $component-interspace; height: 10px;
} }
} }

View File

@ -3,13 +3,7 @@
.empty-page-container { .empty-page-container {
background: var(--background-color); ils-container(1.005, 1.01, 30px, true);
ils-container(1.005, 1.01, 30px);
+ils-tablet() {
ils-container(1.001, 1.005, 20px);
}
.empty-page-content { .empty-page-content {
@ -20,15 +14,5 @@
} }
} }
margin-bottom: $component-interspace;
+ils-tablet() {
margin-bottom: $component-interspace * 0.9;
}
+ils-mobile() {
margin-bottom: $component-interspace * 0.8;
}
} }
} }

View File

@ -2,14 +2,14 @@
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden; overflow: hidden;
background: url("/images/bg.svg") center center / cover no-repeat; background: url("/images/bg.svg") center center / cover no-repeat;
.content { .content {
position: relative;
padding: 30px; padding: 30px;
width: 80%;
height : 80%;
.description { .description {
font-weight: bold; font-weight: bold;
@ -19,7 +19,7 @@
.social-icon-list { .social-icon-list {
position: absolute; position: absolute;
bottom: $component-interspace + 10px; bottom: $component-interspace;
font-size: 26px; font-size: 26px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);

View File

@ -2,9 +2,7 @@
.tagcloud-container { .tagcloud-container {
background: var(--background-color); ils-container(1.005, 1.01, 30px, true);
ils-container(1.005, 1.01, 30px);
.tagcloud-content { .tagcloud-content {

View File

@ -4,10 +4,8 @@
.post-toc-wrap { .post-toc-wrap {
width: 100%; width: 100%;
height: 100%;
font-size: 0.92em; font-size: 0.92em;
box-sizing: border-box; box-sizing: border-box;
background: var(--background-color);
.post-toc { .post-toc {

View File

@ -2,12 +2,7 @@
@require "./common/magic-theme.styl"; @require "./common/magic-theme.styl";
.archive-container { .archive-container {
background: var(--background-color); ils-container(1.005, 1.01, 30px, true);
ils-container(1.005, 1.01, 30px);
+ils-tablet() {
ils-container(1.001, 1.005, 20px);
}
} }

View File

@ -2,10 +2,12 @@
@require 'common/magic-theme.styl' @require 'common/magic-theme.styl'
$avatarWidth = 46px; $avatarWidth = 46px;
$arrow-icon-width = 18px;
$post-nav-max-width = 200px;
.article-content-container { .article-content-container {
ils-container(1.008, 1.002, 30px); ils-container(1.008, 1.002, 30px, true);
.article-title { .article-title {
color: var(--second-text-color); color: var(--second-text-color);
@ -105,6 +107,51 @@ $avatarWidth = 46px;
height: 40px; height: 40px;
margin-top: $component-interspace; margin-top: $component-interspace;
.article-prev, .article-next {
max-width: $post-nav-max-width;
height: 100%;
box-sizing: border-box;
ils-container(1.08, 1.08, 10px, false);
a {
position: relative;
display: block;
width: 100%;
height: 100%;
box-sizing: border-box;
&.prev {
padding-left: $arrow-icon-width;
}
&.next {
padding-right: $arrow-icon-width;
}
.arrow-icon {
position: absolute;
top: 0;
height: 100%;
width: $arrow-icon-width;
&.left {
left: 0;
}
&.right {
right: 0;
}
}
.title {
width: 100%;
height: 100%;
}
}
}
.article-prev { .article-prev {
float: left; float: left;
} }
@ -122,8 +169,13 @@ $avatarWidth = 46px;
} }
.post-nav-title-item { .post-nav-title-item {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ils-tablet() { +ils-tablet() {
display: none; display: none;
} }

View File

@ -2,7 +2,7 @@
.category-container { .category-container {
ils-container(1.02, 1.02, 30px); ils-container(1.02, 1.02, 30px, true);
.category-name { .category-name {
color: var(--second-text-color); color: var(--second-text-color);

View File

@ -3,13 +3,7 @@
.category-list-container { .category-list-container {
background: var(--background-color); ils-container(1.005, 1.01, 30px, true);
ils-container(1.005, 1.01, 30px);
+ils-tablet() {
ils-container(1.001, 1.005, 20px);
}
.category-list-content { .category-list-content {

View File

@ -109,3 +109,13 @@ button {
background: var(--primary-color); background: var(--primary-color);
} }
} }
// ============================
// flex center
// ============================
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}

View File

@ -22,26 +22,41 @@ hover-style(scaleX, scaleY) {
} }
ils-container(scaleX, scaleY, padding) { ils-container(scaleX, scaleY, padding, isMarginBottom) {
position: relative;
background: var(--background-color); background: var(--background-color);
padding: padding; padding: padding;
border-radius: $ils-container-border-radius; border-radius: $ils-container-border-radius;
box-sizing: border-box;
if (isMarginBottom) {
margin-bottom: $ils-container-margin-bottom; margin-bottom: $ils-container-margin-bottom;
+ils-tablet() {
margin-bottom: $ils-container-margin-bottom * 0.8;
}
+ils-mobile() {
margin-bottom: $ils-container-margin-bottom * 0.6;
}
}
hover-style(scaleX, scaleY); hover-style(scaleX, scaleY);
+ils-tablet() { +ils-tablet() {
padding: padding * 0.8; padding: padding * 0.8;
border-radius: $ils-container-border-radius * 0.8; border-radius: $ils-container-border-radius * 0.8;
margin-bottom: $ils-container-margin-bottom * 0.8; //margin-bottom: $ils-container-margin-bottom * 0.8;
hover-style(scaleX * 0.8, scaleY * 0.8); hover-style(scaleX * 0.8, scaleY * 0.8);
} }
+ils-mobile() { +ils-mobile() {
padding: padding * 0.6; padding: padding * 0.6;
border-radius: $ils-container-border-radius * 0.6; border-radius: $ils-container-border-radius * 0.6;
margin-bottom: $ils-container-margin-bottom * 0.6; //margin-bottom: $ils-container-margin-bottom * 0.6;
hover-style(scaleX * 0.6, scaleY * 0.6); hover-style(scaleX * 0.6, scaleY * 0.6);
} }
} }

View File

@ -6,23 +6,19 @@
.home-article-list { .home-article-list {
.home-article-item { .home-article-item {
position: relative;
ils-container(1.02, 1.02, 38px); ils-container(1.02, 1.02, 28px, true);
.top-icon { .top-icon {
position: absolute; position: absolute;
top: 6px; top: 10px;
right: 10px; right: 12px;
font-size: 1.8em; font-size: 1.2em;
transform: rotate(50deg); transform: rotate(45deg);
color : var(--third-text-color);
+ils-tablet() { +ils-tablet() {
display: 1.6em; font-size: 1.16em;
}
+ils-mobile() {
font-size: 1.38em;
} }
} }
@ -43,7 +39,6 @@
font-size: 1.2em; font-size: 1.2em;
} }
margin: 0; margin: 0;
} }

View File

@ -124,13 +124,12 @@ $page-aside-width = $temp-width ? convert($temp-width) : 260px;
bottom: 0; bottom: 0;
left: - $page-aside-width; left: - $page-aside-width;
width: $page-aside-width; width: $page-aside-width;
height: 100%;
z-index: $z-index-6; z-index: $z-index-6;
box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
border-radius: 0 !important; border-radius: 0 !important;
margin-bottom: 0 !important;
ils-container(1.02, 1.02, 20px); ils-container(1.02, 1.02, 18px, false);
+ils-tablet() { +ils-tablet() {
left: 0 !important; left: 0 !important;

View File

@ -3,7 +3,7 @@
.tag-container { .tag-container {
ils-container(1.02, 1.02, 30px); ils-container(1.02, 1.02, 30px, true);
.tag-name { .tag-name {
color: var(--second-text-color); color: var(--second-text-color);