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
page:
left_side_width: 25
right_side_width: 75
media_max_width: 960
# 代码高亮设置
# Code Highlight theme
# 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">
<div class="fold-left-side">
<button class="fold-left-side-btn"
onclick="foldLeftSide()"
>
<i class="fa fa-bars"></i>
</div>
<div></div>
</button>
<ul class="menu-list">
<% for (let i in theme.menu) { %>
<li class="menu-item">

View File

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

View File

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

View File

@ -4,7 +4,7 @@ is_tag('hobby') 如果给定一个字符串作为参数,将会检查目前是
-->
<% if (is_tag()) { %>
<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>
<%- partial('archive-post') %>
<% } %>

View File

@ -1,11 +1,13 @@
@require 'variables.styl'
$archive-year-font-size = 24px;
$archive-article-item-title-font-size = 16px;
$archive-article-date-font-size = 14px;
.archive-container {
.archives-wrap {
margin-bottom 20px
margin-bottom: 20px;
.archive-year {
font-size: $archive-year-font-size;
@ -14,13 +16,14 @@ $archive-year-font-size = 24px;
}
.archive-article-list {
padding-left: 10px;
.archive-article-item {
margin 10px 0
font-size 16px
margin: 10px 0;
font-size: $archive-article-item-title-font-size;
a.archive-article-title {
color $archive-article-title-color
color: $archive-article-title-color;
&:hover {
color: $a-hover-color;
@ -28,7 +31,8 @@ $archive-year-font-size = 24px;
}
.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;
}
button {
padding: 0;
margin: 0;
border: 0;
outline: none;
cursor: pointer;
}
p {
line-height: 2em;
}

View File

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

View File

@ -11,25 +11,16 @@ $nav-font-size = 12px;
border-bottom: 1px solid $border-color
padding: 20px;
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 {
position: absolute;
top: 50%;
transform: translateY(-50%);
margin-left: 30px;
.menu-item {
float: left;
margin-left: 20px;
margin-right: 20px;
.current {
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 {
padding: 2px;
border-radius: 50%;
border-radius: 5%;
border: 1px solid $border-color;
width: 150px;
width: 130px;
}
.title {

View File

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

View File

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

View File

@ -9,7 +9,7 @@
.nav-container {
position: fixed;
top: 0;
width $right-side-width
width: 100%;
height: $nav-height;
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
@ -32,7 +35,7 @@ $default-font-line-height = 20px
$default-font-weight = 400
//
$default-font-color = #777
$default-font-color = #787878
//
$article-title-color = #666
@ -40,7 +43,6 @@ $article-title-color = #666
//
$archive-article-title-color = #8f8f8f
//
$nav-height = 60px
@ -51,7 +53,7 @@ $nav-selected-color = #4a4a4a
$a-color = #666
// a
$a-hover-color = #4786d6
$a-hover-color = #2273d8
//
$button-color = $default-font-color