-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: make navBarLinks component * feat: show nav contents in sidebar when mobile * feat: nav links style in mobile
- Loading branch information
Showing
8 changed files
with
112 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
import { computed } from 'vue' | ||
import { withBase } from '../utils' | ||
import { useSiteDataByRoute } from 'vitepress' | ||
import NavBarLink from './NavBarLink.vue' | ||
import NavDropdownLink from './NavDropdownLink.vue' | ||
import NavBarLinks from './NavBarLinks.vue' | ||
|
||
export default { | ||
components: { | ||
NavBarLink, | ||
NavDropdownLink | ||
NavBarLinks | ||
}, | ||
|
||
setup() { | ||
return { | ||
withBase, | ||
navData: | ||
process.env.NODE_ENV === 'production' | ||
? // navbar items do not change in production | ||
useSiteDataByRoute().value.themeConfig.nav | ||
: // use computed in dev for hot reload | ||
computed(() => useSiteDataByRoute().value.themeConfig.nav) | ||
withBase | ||
} | ||
} | ||
} |
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
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,22 @@ | ||
import { computed } from 'vue' | ||
import { useSiteDataByRoute } from 'vitepress' | ||
import NavBarLink from './NavBarLink.vue' | ||
import NavDropdownLink from './NavDropdownLink.vue' | ||
|
||
export default { | ||
components: { | ||
NavBarLink, | ||
NavDropdownLink | ||
}, | ||
|
||
setup() { | ||
return { | ||
navData: | ||
process.env.NODE_ENV === 'production' | ||
? // navbar items do not change in production | ||
useSiteDataByRoute().value.themeConfig.nav | ||
: // use computed in dev for hot reload | ||
computed(() => useSiteDataByRoute().value.themeConfig.nav) | ||
} | ||
} | ||
} |
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,29 @@ | ||
<template> | ||
<nav class="nav-links" v-if="navData"> | ||
<template v-for="item of navData"> | ||
<NavDropdownLink v-if='item.items' :item="item"/> | ||
<NavBarLink v-else :item="item"/> | ||
</template> | ||
</nav> | ||
</template> | ||
|
||
<script src="./NavBarLinks"></script> | ||
|
||
<style> | ||
.nav-links { | ||
display: flex; | ||
align-items: center; | ||
height: 35px; | ||
list-style-type: none; | ||
transform: translateY(1px); | ||
} | ||
@media screen and (max-width: 719px) { | ||
.nav-links { | ||
display: block; | ||
height: auto; | ||
padding-bottom: 0.5rem; | ||
border-bottom: 1px solid var(--border-color); | ||
} | ||
} | ||
</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
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