diff --git a/src/client/theme-default/components/NavBar.ts b/src/client/theme-default/components/NavBar.ts index 3e706e693ba9..79dd878278a2 100644 --- a/src/client/theme-default/components/NavBar.ts +++ b/src/client/theme-default/components/NavBar.ts @@ -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 } } } diff --git a/src/client/theme-default/components/NavBar.vue b/src/client/theme-default/components/NavBar.vue index 50f2cffc48d7..b99bfafafbff 100644 --- a/src/client/theme-default/components/NavBar.vue +++ b/src/client/theme-default/components/NavBar.vue @@ -12,12 +12,7 @@ /> {{ $site.title }} - + @@ -35,16 +30,8 @@ vertical-align: bottom; } -.nav-links { - display: flex; - align-items: center; - height: 35px; - list-style-type: none; - transform: translateY(1px); -} - @media screen and (max-width: 719px) { - .nav-links { + .hide-mobile { display: none; } } diff --git a/src/client/theme-default/components/NavBarLink.vue b/src/client/theme-default/components/NavBarLink.vue index f6f5da6bb40c..62cfe7b6b015 100644 --- a/src/client/theme-default/components/NavBarLink.vue +++ b/src/client/theme-default/components/NavBarLink.vue @@ -25,7 +25,7 @@ } .nav-link { - display: inline-block; + display: block; margin-bottom: -2px; border-bottom: 2px solid transparent; font-size: 0.9rem; @@ -43,4 +43,23 @@ .nav-link.external:hover { border-bottom-color: transparent; } + +@media screen and (max-width: 719px) { + .nav-item { + margin-left: 0; + padding: 0.35rem 1.5rem 0.35rem 1.25rem; + } + + .nav-link { + line-height: 1.7; + font-size: 1em; + font-weight: 600; + border-bottom: none; + margin-bottom: 0; + } + .nav-link:hover, + .nav-link.active { + color: var(--accent-color); + } +} diff --git a/src/client/theme-default/components/NavBarLinks.ts b/src/client/theme-default/components/NavBarLinks.ts new file mode 100644 index 000000000000..e41aa966e6a2 --- /dev/null +++ b/src/client/theme-default/components/NavBarLinks.ts @@ -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) + } + } +} diff --git a/src/client/theme-default/components/NavBarLinks.vue b/src/client/theme-default/components/NavBarLinks.vue new file mode 100644 index 000000000000..15b9abc220a8 --- /dev/null +++ b/src/client/theme-default/components/NavBarLinks.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/client/theme-default/components/NavDropdownLink.vue b/src/client/theme-default/components/NavDropdownLink.vue index fb17a53321c4..71aaaf2c61a4 100644 --- a/src/client/theme-default/components/NavDropdownLink.vue +++ b/src/client/theme-default/components/NavDropdownLink.vue @@ -10,7 +10,7 @@ -