Skip to content

Commit

Permalink
feat: add showMarker options
Browse files Browse the repository at this point in the history
  • Loading branch information
WRXinYue committed Aug 27, 2024
1 parent 335a849 commit 5d75bf9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/pages/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- 新增 TagsThemeSakura 组件彩虹色标签样式
- 新增 navbarOptions showMarker 配置项

### Removed

Expand Down
34 changes: 34 additions & 0 deletions docs/valaxy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,40 @@ export default defineValaxyConfig<ThemeConfig>({
primary: '#ff4e6a',
},

navbar: [
{
text: 'Docs',
link: '/guide/installation',
children: [
{
text: 'Quick Start',
link: '/guide/installation',
},
{
text: 'Config',
link: '/config/theme',
},
{
text: 'Examples',
link: '/examples/config',
},
],
},
// {
// text: 'Themes',
// },
{
text: 'Gallery',
link: '/examples/gallery',
},
{
text: 'GitHub',
link: 'https://github.com/WRXinYue/valaxy-theme-sakura',
},
],
navbarOptions: {
showMarker: false,
},
navbarTitle: ['Valaxy Theme', '', 'Sakura'],

// addons: [
Expand Down
6 changes: 5 additions & 1 deletion theme/components/SakuraNavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const { locale } = useI18n()
const marker = ref()
const navLinkItems = computed(() => (navbar || themeConfig.value.navbar))
const showMarker = computed(() => (themeConfig.value.navbarOptions?.showMarker))
watch(() => route.path, () => {
nextTick(updateMarker)
Expand All @@ -26,6 +27,9 @@ watch(() => locale.value, () => {
})
function updateMarker() {
if (!showMarker.value)
return
const routeActive = document.querySelector('.sakura-nav-link .router-link-active') as HTMLElement
if (!routeActive)
return
Expand All @@ -49,7 +53,7 @@ onMounted(() => {
<span v-if="i !== (navbar?.length || themeConfig.navbar.length) - 1" class="ml-3 mr-3" />
</template>
<div id="marker" />
<div v-if="showMarker" id="marker" />
</nav>
</template>
Expand Down
1 change: 1 addition & 0 deletions theme/styles/widgets/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
background: var(--st-c-bg-nav);
}

// TODO: remove
&.col {
flex-direction: column;
height: 100vh;
Expand Down

0 comments on commit 5d75bf9

Please sign in to comment.