Skip to content

Commit a7ec279

Browse files
authored
Merge pull request #331 from ewt45/patch-1
fix(NavbarLinks): darkmode button and social links display wrongly
2 parents dfede33 + 926d524 commit a7ec279

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/vuepress-theme-reco/src/client/components/NavbarLinks/index.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<template>
2-
<nav v-if="navbarConfig.length || socialLinks.length || navbarSelectLanguage" class="navbar-links">
2+
<nav
3+
v-if="navbarConfig.length || socialLinks.length || navbarSelectLanguage || showToggleDarkModeButton"
4+
class="navbar-links"
5+
>
36
<div v-for="(item, index) in navbarConfig" :key="index" class="navbar-links__item">
47
<template v-if="'children' in item && item.children">
58
<DropdownLink :item="item" />
@@ -20,11 +23,11 @@
2023
/>
2124

2225
<ToggleDarkModeButton
23-
v-if="!isMobile && (themeLocal.colorModeSwitch ?? true)"
26+
v-if="showToggleDarkModeButton"
2427
class="btn--dark-mode navbar-links__item"
2528
/>
2629

27-
<ul class="social-links navbar-links__item">
30+
<ul v-if="socialLinks.length" class="social-links navbar-links__item">
2831
<li
2932
class="social-item"
3033
v-for="(item, index) in socialLinks"
@@ -42,6 +45,7 @@ import { useSocialLinks } from './useSocialLinks.js'
4245
import { useNavbarConfig } from './useNavbarConfig.js'
4346
import { useMobile, useThemeLocaleData } from '@composables/index.js'
4447
import { useNavbarSelectLanguage } from './useNavbarSelectLanguage.js'
48+
import { computed } from 'vue'
4549
4650
import Link from '@components/Link.vue'
4751
import DropdownLink from '@components/DropdownLink/index.vue'
@@ -54,4 +58,5 @@ const navbarConfig = useNavbarConfig()
5458
const themeLocal = useThemeLocaleData()
5559
const navbarSelectLanguage = useNavbarSelectLanguage()
5660
const { socialLinks, jumpSocialLink } = useSocialLinks()
61+
const showToggleDarkModeButton = computed(() => !isMobile.value && (themeLocal.colorModeSwitch ?? true))
5762
</script>

0 commit comments

Comments
 (0)