Skip to content

Commit 4ed1917

Browse files
author
reco_luan
committed
fix: Optimize style
1. searchbox 2. pagation 3. add personal info at siderbar
1 parent b3e0970 commit 4ed1917

File tree

10 files changed

+70
-54
lines changed

10 files changed

+70
-54
lines changed

components/HomeBlog.vue

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,7 @@
4747
@getCurrentPage="getCurrentPage" />
4848
</div>
4949
<div class="info-wrapper">
50-
<img class="personal-img" :src="$frontmatter.faceImage ? $withBase($frontmatter.faceImage) : require('../images/home-head.png')" alt="hero">
51-
<h3 class="name" v-if="$themeConfig.author || $site.title">{{ $themeConfig.author || $site.title }}</h3>
52-
<div class="num">
53-
<div>
54-
<h3>{{$recoPosts.length}}</h3>
55-
<h6>文章</h6>
56-
</div>
57-
<div>
58-
<h3>{{$tags.list.length}}</h3>
59-
<h6>标签</h6>
60-
</div>
61-
</div>
62-
<hr>
50+
<PersonalInfo/>
6351
<h4><i class="iconfont reco-category"></i> 分类</h4>
6452
<ul class="category-wrapper">
6553
<li class="category-item" v-for="(item, index) in this.$categories.list" :key="index">
@@ -90,12 +78,13 @@ import FriendLink from '@theme/components/FriendLink'
9078
import NoteAbstract from '@theme/components/NoteAbstract'
9179
import pagination from '@theme/mixins/pagination'
9280
import ModuleTransition from '@theme/components/ModuleTransition'
81+
import PersonalInfo from '@theme/components/PersonalInfo'
9382
import { getOneColor } from '@theme/helpers/other'
9483
import moduleTransitonMixin from '@theme/mixins/moduleTransiton'
9584
9685
export default {
9786
mixins: [pagination, moduleTransitonMixin],
98-
components: { NoteAbstract, TagList, FriendLink, ModuleTransition },
87+
components: { NoteAbstract, TagList, FriendLink, ModuleTransition, PersonalInfo },
9988
data () {
10089
return {
10190
recoShow: false,
@@ -248,39 +237,6 @@ export default {
248237
&:hover {
249238
box-shadow: var(--box-shadow-hover);
250239
}
251-
.personal-img {
252-
display block
253-
margin 2rem auto
254-
width 8rem
255-
height 8rem
256-
border-radius 50%
257-
}
258-
.name {
259-
text-align center
260-
color var(--text-color)
261-
}
262-
.num {
263-
display flex
264-
margin 0 auto 1rem
265-
width 80%
266-
> div {
267-
text-align center
268-
flex auto
269-
&:first-child {
270-
border-right 1px solid #333
271-
}
272-
h3 {
273-
line-height auto
274-
margin 0 0 .6rem
275-
color var(--text-color)
276-
}
277-
h6 {
278-
line-height auto
279-
color var(--text-color)
280-
margin 0
281-
}
282-
}
283-
}
284240
h4 {
285241
color var(--text-color)
286242
}

components/Navbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ $navbar-horizontal-padding = 1.5rem
115115
right $navbar-horizontal-padding
116116
top $navbar-vertical-padding
117117
display flex
118+
background-color var(--background-color)
118119
.search-box
119120
flex: 0 0 auto
120121
vertical-align top
121-
margin-right 1rem
122122
123123
@media (max-width: $MQMobile)
124124
.navbar

components/PersonalInfo.vue

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<template>
2+
<div class="personal-info-wrapper">
3+
<img class="personal-img" :src="$frontmatter.faceImage ? $withBase($frontmatter.faceImage) : require('../images/home-head.png')" alt="hero">
4+
<h3 class="name" v-if="$themeConfig.author || $site.title">{{ $themeConfig.author || $site.title }}</h3>
5+
<div class="num">
6+
<div>
7+
<h3>{{$recoPosts.length}}</h3>
8+
<h6>文章</h6>
9+
</div>
10+
<div>
11+
<h3>{{$tags.list.length}}</h3>
12+
<h6>标签</h6>
13+
</div>
14+
</div>
15+
<hr>
16+
</div>
17+
</template>
18+
19+
<style lang="stylus" scoped>
20+
.personal-info-wrapper {
21+
.personal-img {
22+
display block
23+
margin 2rem auto
24+
width 8rem
25+
height 8rem
26+
border-radius 50%
27+
}
28+
.name {
29+
text-align center
30+
color var(--text-color)
31+
}
32+
.num {
33+
display flex
34+
margin 0 auto 1rem
35+
width 80%
36+
> div {
37+
text-align center
38+
flex auto
39+
&:first-child {
40+
border-right 1px solid #333
41+
}
42+
h3 {
43+
line-height auto
44+
margin 0 0 .6rem
45+
color var(--text-color)
46+
}
47+
h6 {
48+
line-height auto
49+
color var(--text-color)
50+
margin 0
51+
}
52+
}
53+
}
54+
}
55+
</style>

components/SearchBox.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export default {
221221
height 2rem
222222
@media (max-width: $MQNarrow) and (min-width: $MQMobile)
223223
.search-box
224+
margin-right 0
224225
.suggestions
225226
left 0
226227
@media (max-width: $MQMobile)

components/Sidebar.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<aside class="sidebar">
3+
<PersonalInfo/>
34
<NavLinks/>
45
<slot name="top"/>
56
<SidebarLinks :depth="0" :items="items"/>
@@ -9,19 +10,22 @@
910

1011
<script>
1112
import SidebarLinks from '@theme/components/SidebarLinks'
13+
import PersonalInfo from '@theme/components/PersonalInfo'
1214
import NavLinks from '@theme/components/NavLinks'
1315
1416
export default {
1517
name: 'Sidebar',
1618
17-
components: { SidebarLinks, NavLinks },
19+
components: { SidebarLinks, NavLinks, PersonalInfo },
1820
1921
props: ['items']
2022
}
2123
</script>
2224

2325
<style lang="stylus">
2426
.sidebar
27+
.personal-info-wrapper
28+
display none
2529
ul
2630
padding 0
2731
margin 0
@@ -50,6 +54,8 @@ export default {
5054
5155
@media (max-width: $MQMobile)
5256
.sidebar
57+
.personal-info-wrapper
58+
display block
5359
.nav-links
5460
display block
5561
.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active::after

layouts/Category.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<!-- 分页 -->
3232
<ModuleTransition delay="0.16">
3333
<pagation
34-
v-show="recoShowModule"
3534
class="pagation"
3635
:total="posts.length"
3736
:currentPage="currentPage"

layouts/Tag.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<!-- 分页 -->
2525
<ModuleTransition delay="0.16">
2626
<pagation
27-
v-show="recoShowModule"
2827
class="pagation"
2928
:total="posts.length"
3029
:currentPage="currentPage"

layouts/Tags.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<!-- 分页 -->
2424
<ModuleTransition delay="0.16">
2525
<pagation
26-
v-show="recoShowModule"
2726
class="pagation"
2827
:total="$recoPosts.length"
2928
:currentPage="currentPage"

layouts/TimeLines.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default {
7171
position: absolute;
7272
top: 14px;
7373
left: 0;
74+
z-index: -1;
7475
margin-left: -2px;
7576
width: 4px;
7677
height: 100%;
@@ -84,7 +85,7 @@ export default {
8485
content: " ";
8586
position: absolute;
8687
z-index 2;
87-
left: -19px;
88+
left: -20px;
8889
top: 50%;
8990
margin-left: -4px;
9091
margin-top: -4px;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"_from": "vuepress-theme-reco@0.2.1",
2828
"_resolved": "http://registry.npm.taobao.org/vuepress-theme-reco/download/vuepress-theme-reco-0.2.1.tgz",
2929
"dependencies": {
30-
"@vuepress-reco/vuepress-plugin-back-to-top": "1.0.7",
30+
"@vuepress-reco/vuepress-plugin-back-to-top": "1.0.8",
3131
"@vuepress-reco/vuepress-plugin-extract-code": "1.0.3",
3232
"@vuepress-reco/vuepress-plugin-loading-page": "1.0.5",
3333
"@vuepress-reco/vuepress-plugin-pagation": "1.0.6",

0 commit comments

Comments
 (0)