Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
feat: using GlobalLayout to simplify implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Jun 5, 2019
1 parent 0add205 commit 8c89670
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 121 deletions.
2 changes: 0 additions & 2 deletions components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
</template>

<script>
import NavLink from './NavLink'
import {
GithubIcon,
FacebookIcon,
Expand All @@ -31,7 +30,6 @@
export default {
components: {
NavLink,
GithubIcon,
FacebookIcon,
TwitterIcon,
Expand Down
6 changes: 1 addition & 5 deletions components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@

<script>
import SearchBox from '@SearchBox'
import NavLink from './NavLink'
export default {
components: {
SearchBox,
NavLink,
},
components: { SearchBox },
}
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<template>
<LayoutWrapper class="common-layout">
<div id="base-list-layout">
<div class="ui-post" v-for="page in pages">
<div class="ui-post-title">
<a :href="page.path">{{ page.title }}</a>
<NavLink :link="page.path">{{ page.title }}</NavLink>
</div>
<div class="ui-post-summary">
<Content :page-key="page.key" slot-key="intro"/>
</div>
<div class="ui-post-summary"><Content :page-key="page.key" slot-key="intro" /></div>
<div class="ui-post-author" v-if="page.frontmatter.author">
<NavigationIcon /> <span>{{ page.frontmatter.author }} in {{ page.frontmatter.location }}</span>
<NavigationIcon/>
<span>{{ page.frontmatter.author }} in {{ page.frontmatter.location }}</span>
</div>
<div class="ui-post-date" v-if="page.frontmatter.date">
<ClockIcon /> <span>{{ new Date(page.frontmatter.date.trim()).toDateString() }}</span>
<ClockIcon/>
<span>{{ new Date(page.frontmatter.date.trim()).toDateString() }}</span>
</div>
</div>

<Pagination :pagination="pagination"/>
</LayoutWrapper>
</div>
</template>

<script>
Expand All @@ -26,7 +30,7 @@
components: { Toc, Pagination, NavigationIcon, ClockIcon },
props: ['pagination'],
computed: {
pages () {
pages() {
return this.pagination.pages
}
},
Expand All @@ -40,18 +44,21 @@
.ui-post
margin-bottom 50px
p
margin 0
.ui-post-title
font-weight bold
font-size 24px
border-bottom 0
a
cursor pointer
color #000
transition all .2s
text-decoration none
&:hover
text-decoration underline
Expand All @@ -67,6 +74,7 @@
line-height 12px
color rgba(0, 0, 0, 0.84)
margin-bottom 3px
svg
margin-right 5px
width 14px
Expand All @@ -77,6 +85,7 @@
align-items center
font-size 12px
color rgba(0, 0, 0, 0.54)
svg
margin-right 5px
width 14px
Expand Down
2 changes: 1 addition & 1 deletion global-components/BlogTag.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<router-link class="blog-tag" :to="tag.path">
{{ tag.name }} ({{ tag.posts.length }})
{{ tag.name }} ({{ tag.pages.length }})
</router-link>
</template>

Expand Down
28 changes: 0 additions & 28 deletions global-components/LayoutWrapper.vue

This file was deleted.

2 changes: 1 addition & 1 deletion components/NavLink.vue → global-components/NavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>

<script>
import { isExternal, isMailto, isTel, ensureExt } from './util'
import { isExternal, isMailto, isTel, ensureExt } from '../components/util'
export default {
props: {
Expand Down
33 changes: 0 additions & 33 deletions layouts/FrontmatterClassifier2.vue

This file was deleted.

31 changes: 31 additions & 0 deletions layouts/GlobalLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div id="vuperess-theme-blog__global-layout">
<Header/>
<div class="content-wrapper">
<DefaultGlobalLayout/>
</div>
<Footer/>
</div>
</template>

<script>
import GlobalLayout from '@app/components/GlobalLayout.vue'
import Header from '@theme/components/Header.vue'
import Footer from '@theme/components/Header.vue'
export default {
components: {
DefaultGlobalLayout: GlobalLayout,
Header,
Footer,
},
}
</script>

<style lang="stylus">
.content-wrapper
padding-top 160px
min-height calc(100vh - 80px - 60px)
max-width 740px
padding-left 20vw
</style>
17 changes: 0 additions & 17 deletions layouts/IndexWriting.vue

This file was deleted.

18 changes: 2 additions & 16 deletions layouts/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
<template>
<BaseListLayout :pagination="pagination"/>
<BaseListLayout :pagination="$pagination"/>
</template>

<script>
import BaseListLayout from './BaseListLayout'
export default {
components: { BaseListLayout },
computed: {
pagination() {
if (this.$route.meta.pid) {
return this.$pagination
}
return this.$getPagination('post')
},
},
}
</script>
<style src="prismjs/themes/prism-okaidia.css"></style>
4 changes: 2 additions & 2 deletions layouts/Post.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<LayoutWrapper>
<div id="vuperess-theme-blog__post-layout">
<!--<h1>{{ $page.title }}</h1>-->
<Content class="vuepress-blog-theme-content"/>
<Toc/>
</LayoutWrapper>
</div>
</template>

<script>
Expand Down
11 changes: 3 additions & 8 deletions layouts/Tags.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<template>
<LayoutWrapper class="tags-layout">
<div class="main">
<BlogTags :tags="$tag.list"/>
</div>
</LayoutWrapper>
<div id="vuperess-theme-blog__tags-layout">
<BlogTags :tags="$tag.list"/>
</div>
</template>

<script>
Expand All @@ -14,6 +12,3 @@
}
</script>

<style lang="stylus">
</style>

0 comments on commit 8c89670

Please sign in to comment.