Skip to content

Commit

Permalink
feat: add navbar support (close #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
viko16 committed Apr 29, 2019
1 parent 10fd13f commit 16039cb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
25 changes: 25 additions & 0 deletions components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<div
v-if="navbar"
class="navbar"
>
<a
v-for="(url, name) in navbar"
:key="name"
:href="url"
target="_blank"
class="navbar-item"
rel="noopener noreferrer"
>{{ name }}</a>
</div>
</template>

<script>
export default {
computed: {
navbar() {
return this.$themeConfig.navbar || null
}
}
}
</script>
8 changes: 6 additions & 2 deletions layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
<router-link
to="/"
:title="$description"
class="site-name"
>
{{ $site.title }}
</router-link>
<div style="clear: both" />
<nav-bar />
</header>
<HomePage v-if="isHome" />
<PostPage v-else />
<home-page v-if="isHome" />
<post-page v-else />
<footer-bar />
</div>
</template>
Expand All @@ -19,12 +21,14 @@
import HomePage from "../components/Home";
import PostPage from "../components/Post";
import FooterBar from '../components/FooterBar';
import NavBar from '../components/NavBar';
export default {
components: {
HomePage,
PostPage,
FooterBar,
NavBar,
},
computed: {
isHome() {
Expand Down
12 changes: 10 additions & 2 deletions styles/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,23 @@ code
// Shared
// -----------------------------------------
.header
margin 50px auto
margin 50px auto 40px
text-align center

a
.site-name
font-size fontSize + 2
letter-spacing 5px
text-transform uppercase
color textColor

.navbar
margin 10px 10px 0

.navbar-item
margin-right 10px
color metaColor
text-decoration underline

.searchbar-input
display block
margin 5px auto 0
Expand Down

0 comments on commit 16039cb

Please sign in to comment.