-
-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
405 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<header class="Header"> | ||
<div class="Wrap" :class="{'is-center': $store.getters.centerContent}"> | ||
<div class="header-inner"> | ||
<div class="header-left"> | ||
<h1 class="site-title"> | ||
<SidebarToggle /> | ||
<router-link to="/">{{ $store.getters.config.title }}</router-link> | ||
</h1> | ||
<HeaderNav v-if="leftNav" :nav="leftNav" /> | ||
</div> | ||
<div class="header-right"> | ||
<HeaderNav v-if="rightNav" :nav="rightNav" /> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
</template> | ||
|
||
<script> | ||
import HeaderNav from './HeaderNav.vue' | ||
import SidebarToggle from './SidebarToggle.vue' | ||
export default { | ||
components: { | ||
HeaderNav, | ||
SidebarToggle | ||
}, | ||
computed: { | ||
leftNav() { | ||
const {nav} = this.$store.getters.config | ||
return ( | ||
nav && | ||
nav.filter(item => { | ||
return item.position === 'left' | ||
}) | ||
) | ||
}, | ||
rightNav() { | ||
const {nav} = this.$store.getters.config | ||
return ( | ||
nav && | ||
nav.filter(item => { | ||
return item.position === 'right' || !item.position | ||
}) | ||
) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
|
||
<style scoped> | ||
@import 'vars.css'; | ||
.Header { | ||
height: var(--header-height); | ||
line-height: var(--header-height); | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
z-index: 33; | ||
border-bottom: 1px solid var(--border-color); | ||
background: var(--sidebar-bg); | ||
} | ||
.site-title { | ||
font-weight: normal; | ||
margin: 0 25px 0 0; | ||
font-size: 1.2rem; | ||
display: flex; | ||
align-items: center; | ||
& a { | ||
color: #000; | ||
text-decoration: none; | ||
} | ||
} | ||
.header-inner { | ||
padding: 0 20px; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.header-left { | ||
display: flex; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<div class="header-nav"> | ||
<div class="header-nav-item" v-for="(item, index) in nav" :key="index"> | ||
<a v-if="isExternalLink(item.link)" :href="item.link" target="_blank"> | ||
{{ item.title }} | ||
<external-link-icon /> | ||
</a> | ||
<router-link v-else :to="item.link" :class="{active: $route.path === item.link}"> | ||
{{ item.title }} | ||
</router-link> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {isExternalLink} from '../utils' | ||
export default { | ||
props: { | ||
nav: { | ||
type: Array, | ||
required: true | ||
} | ||
}, | ||
methods: { | ||
isExternalLink | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.header-nav { | ||
display: flex; | ||
& .header-nav-item { | ||
&:not(:first-child) { | ||
margin-left: 20px; | ||
} | ||
} | ||
& a { | ||
color: #999; | ||
text-decoration: none; | ||
&:hover, | ||
&.active { | ||
color: #000; | ||
} | ||
} | ||
@media (max-width: 768px) { | ||
display: none; | ||
} | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<div class="mobile-header-nav"> | ||
<div class="header-nav-item" v-for="(item, index) in nav" :key="index"> | ||
<a v-if="isExternalLink(item.link)" :href="item.link" target="_blank"> | ||
{{ item.title }} | ||
<external-link-icon /> | ||
</a> | ||
<router-link v-else :to="item.link" :class="{active: $route.path === item.link}"> | ||
{{ item.title }} | ||
</router-link> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {isExternalLink} from '../utils' | ||
export default { | ||
props: { | ||
nav: { | ||
type: Array, | ||
requried: true | ||
} | ||
}, | ||
methods: { | ||
isExternalLink | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
@import 'vars.css'; | ||
.mobile-header-nav { | ||
padding: 0 20px; | ||
margin-bottom: 30px; | ||
padding-bottom: 30px; | ||
font-weight: bold; | ||
font-size: 1.1rem; | ||
border-bottom: 1px solid var(--border-color); | ||
& a { | ||
color: #000; | ||
text-decoration: none; | ||
&.active { | ||
color: var(--accent-color); | ||
} | ||
} | ||
@media (min-width: 768px) { | ||
display: none; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<span class="sidebar-toggle" @click="toggleSidebar"> | ||
<svg aria-hidden="true" role="img" viewBox="0 0 448 512"> | ||
<path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path> | ||
</svg> | ||
</span> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
toggleSidebar() { | ||
this.$store.commit('TOGGLE_SIDEBAR') | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.sidebar-toggle { | ||
display: flex; | ||
height: 100%; | ||
align-items: center; | ||
@media (min-width: 768px) { | ||
display: none; | ||
} | ||
& svg { | ||
width: 20px; | ||
height: 20px; | ||
margin-right: 10px; | ||
} | ||
} | ||
</style> |
Oops, something went wrong.