Update: 优化样式

This commit is contained in:
XPoet 2020-03-22 20:31:13 +08:00
parent a5ee7e027e
commit a85da42fee
14 changed files with 83 additions and 38 deletions

View File

@ -8,6 +8,13 @@ favicon: images/favicon.png
avatar: images/favicon.png avatar: images/favicon.png
page:
left_side_width: 25
right_side_width: 75
media_max_width: 960
# 代码高亮设置 # 代码高亮设置
# Code Highlight theme # Code Highlight theme
# Available value: # Available value:

View File

@ -1,8 +1,20 @@
<script>
/**
* 折叠左侧栏
*/
let isOpenLeftSide = true;
const foldLeftSide = () => {
document.querySelector('.page-left').style.display = isOpenLeftSide ? 'none' : 'block';
document.querySelector('.page-right').style.width = isOpenLeftSide ? '100%' : '<%= theme.page.right_side_width + '%' %>';
isOpenLeftSide = !isOpenLeftSide;
};
</script>
<nav class="nav"> <nav class="nav">
<div class="fold-left-side"> <button class="fold-left-side-btn"
onclick="foldLeftSide()"
>
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</div> </button>
<div></div>
<ul class="menu-list"> <ul class="menu-list">
<% for (let i in theme.menu) { %> <% for (let i in theme.menu) { %>
<li class="menu-item"> <li class="menu-item">

View File

@ -15,7 +15,7 @@
<%- truncate(strip_html(post.content), {length: 80}) %> <%- truncate(strip_html(post.content), {length: 80}) %>
</div> </div>
<div class="article-meta-info-container"> <div class="article-post-meta-info">
<%- partial('common/article-meta-info', {articleObject: post, index: true}) %> <%- partial('common/article-meta-info', {articleObject: post, index: true}) %>
</div> </div>
</li> </li>

View File

@ -1,7 +1,7 @@
<div class="right-side-container"> <div class="right-side-container">
<div class="nav-container animated"> <div class="nav-container animated">
<%- partial('common/nav') %> <%- partial('common/nav', { cache: true }) %>
</div> </div>
<div class="article-post-container animated"> <div class="article-post-container animated">

View File

@ -4,7 +4,7 @@ is_tag('hobby') 如果给定一个字符串作为参数,将会检查目前是
--> -->
<% if (is_tag()) { %> <% if (is_tag()) { %>
<div class="tag-container"> <div class="tag-container">
<div class="tag-name"><%- __('tag') %><%= page.tag %> [<%= page.posts.length %>]</div> <div class="tag-name"><i class="fa fa-tag"></i> <%- __('tag') %><%= page.tag %> [<%= page.posts.length %>]</div>
</div> </div>
<%- partial('archive-post') %> <%- partial('archive-post') %>
<% } %> <% } %>

View File

@ -1,26 +1,29 @@
@require 'variables.styl' @require 'variables.styl'
$archive-year-font-size = 24px; $archive-year-font-size = 24px;
$archive-article-item-title-font-size = 16px;
$archive-article-date-font-size = 14px;
.archive-container { .archive-container {
.archives-wrap { .archives-wrap {
margin-bottom 20px margin-bottom: 20px;
.archive-year { .archive-year {
font-size: $archive-year-font-size; font-size: $archive-year-font-size;
color: $article-title-color ; color: $article-title-color;
font-weight: 600; font-weight: 600;
} }
.archive-article-list { .archive-article-list {
padding-left: 10px;
.archive-article-item { .archive-article-item {
margin 10px 0 margin: 10px 0;
font-size 16px font-size: $archive-article-item-title-font-size;
a.archive-article-title { a.archive-article-title {
color $archive-article-title-color color: $archive-article-title-color;
&:hover { &:hover {
color: $a-hover-color; color: $a-hover-color;
@ -28,7 +31,8 @@ $archive-year-font-size = 24px;
} }
.archive-article-date { .archive-article-date {
float right font-size: $archive-article-date-font-size;
float: right;
} }
} }
} }

View File

@ -18,6 +18,14 @@ ul, li, ol {
list-style: none; list-style: none;
} }
button {
padding: 0;
margin: 0;
border: 0;
outline: none;
cursor: pointer;
}
p { p {
line-height: 2em; line-height: 2em;
} }

View File

@ -11,7 +11,7 @@
.site-info-container { .site-info-container {
position absolute position absolute
width 100% width 100%
top 40% top 30%
transform: translateY(-50%); transform: translateY(-50%);
} }

View File

@ -11,25 +11,16 @@ $nav-font-size = 12px;
border-bottom: 1px solid $border-color border-bottom: 1px solid $border-color
padding: 20px; padding: 20px;
font-size: $nav-font-size; font-size: $nav-font-size;
display: flex;
justify-content: flex-end;
.fold-left-side {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size 20px
left: 20px
}
.menu-list { .menu-list {
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
margin-left: 30px;
.menu-item { .menu-item {
float: left; float: left;
margin-left: 20px; margin-right: 20px;
.current { .current {
padding-bottom: 20px; padding-bottom: 20px;
@ -37,4 +28,25 @@ $nav-font-size = 12px;
} }
} }
} }
.fold-left-side-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size 20px
color: $a-color
}
@media screen and (max-width: $media-max-width) {
.fold-left-side-btn {
display: none
}
.menu-list {
margin-left: 0;
}
}
} }

View File

@ -8,9 +8,9 @@ $description-font-size = 16px
.avatar { .avatar {
padding: 2px; padding: 2px;
border-radius: 50%; border-radius: 5%;
border: 1px solid $border-color; border: 1px solid $border-color;
width: 150px; width: 130px;
} }
.title { .title {

View File

@ -7,7 +7,7 @@
.article-post-item { .article-post-item {
margin-bottom 30px margin-bottom 30px
padding-bottom 20px padding-bottom 30px
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
.article-post-title { .article-post-title {

View File

@ -22,13 +22,13 @@
position relative position relative
} }
@media screen and (max-width: 960px) { @media screen and (max-width: $media-max-width) {
.page-left { .page-left {
display: none display: none !important;
} }
.page-right { .page-right {
width: 100% width: 100% !important;
} }
} }

View File

@ -9,7 +9,7 @@
.nav-container { .nav-container {
position: fixed; position: fixed;
top: 0; top: 0;
width $right-side-width width: 100%;
height: $nav-height; height: $nav-height;
z-index: 999; z-index: 999;
} }

View File

@ -1,8 +1,11 @@
// //
$left-side-width = 30% $left-side-width = hexo-config("page.left_side_width") + '%'
// //
$right-side-width = 70% $right-side-width = hexo-config("page.right_side_width") + '%'
//
$media-max-width = hexo-config('page.media_max_width') px
// //
$background-color = #fff $background-color = #fff
@ -32,7 +35,7 @@ $default-font-line-height = 20px
$default-font-weight = 400 $default-font-weight = 400
// //
$default-font-color = #777 $default-font-color = #787878
// //
$article-title-color = #666 $article-title-color = #666
@ -40,7 +43,6 @@ $article-title-color = #666
// //
$archive-article-title-color = #8f8f8f $archive-article-title-color = #8f8f8f
// //
$nav-height = 60px $nav-height = 60px
@ -51,7 +53,7 @@ $nav-selected-color = #4a4a4a
$a-color = #666 $a-color = #666
// a // a
$a-hover-color = #4786d6 $a-hover-color = #2273d8
// //
$button-color = $default-font-color $button-color = $default-font-color