11<script lang="ts" setup>
22import type { NavItem } from ' ../types'
3- import { useAppStore } from ' valaxy'
4- import { ref } from ' vue'
3+ import { useToggle } from ' @vueuse/core'
54import { useThemeConfig } from ' ../composables'
65
76defineProps <{
@@ -11,35 +10,19 @@ defineProps<{
1110}>()
1211
1312const themeConfig = useThemeConfig ()
14- const appStore = useAppStore ()
1513
16- const isOpen = ref (false )
17- // const isMobile = useMobile()
18-
19- function open() {
20- isOpen .value = true
21- }
22-
23- function close() {
24- isOpen .value = false
25- }
26-
27- function toggle() {
28- isOpen .value ? close () : open ()
29- }
14+ const [isOpen, toggle] = useToggle (false )
3015 </script >
3116
3217<template >
3318 <nav class =" oceanus-nav" w =" full" role =" navigation" :class =" [isOpen && 'screen-open']" >
3419 <div class =" nav-content" flex =" ~ items-center" >
3520 <div class =" oceanus-safe-padding nav-content-header" flex =" ~ center md:justify-between" >
36- <OceanusNavMenu class =" nav-menu left-2 z-50 absolute! md:hidden" h =" full" :active =" isOpen" @click =" toggle" />
21+ <OceanusNavMenu class =" nav-menu left-2 z-50 absolute! md:hidden" h =" full" :active =" isOpen" @click =" toggle() " />
3722
38- <AppLink to =" /" :aria-label =" title" >
39- <div class =" h-30px flex text-center text-xl" >
40- <img v-if =" favicon" class =" mr-2 object-cover" alt =" logo" :src =" favicon" >
41- <span class =" oceanus-text oceanus-nav-title md:inline" >{{ title }}</span >
42- </div >
23+ <AppLink to =" /" :aria-label =" title" class =" flex text-center" >
24+ <img v-if =" favicon" class =" oceanus-nav-icon mr-2 object-cover text-xl" alt =" logo" :src =" favicon" >
25+ <span class =" oceanus-text oceanus-nav-title text-xl md:inline" >{{ title }}</span >
4326 </AppLink >
4427
4528 <div class =" items-center leading-5 <md:hidden" >
@@ -55,30 +38,11 @@ function toggle() {
5538 </template >
5639 </div >
5740
58- <div flex =" ~ center" class =" <md:hidden" >
59- <div flex =" ~ center" >
60- <OceanusToggleLocale />
61-
62- <div class =" oceanus-nav-toolbar-text text-icon" flex =" ~ center" >
63- <button type =" button" aria-label =" Toggle Dark Mode" @click =" appStore.toggleDarkWithTransition" >
64- <div v-if =" !appStore.isDark" i-tabler-sun />
65- <div v-else i-tabler-moon />
66- </button >
67- </div >
68- </div >
69-
70- <div v-if =" themeConfig.header?.github" class =" text-b" flex =" ~ center" >
71- <AppLink class =" oceanus-nav-toolbar-text text-icon" :to =" themeConfig.header.github" >
72- <div i-ri-github-fill />
73- </AppLink >
41+ <slot name =" toolbar" >
42+ <div flex =" ~ center" class =" oceanus-nav-toolbar <md:hidden" >
43+ <OceanusNavTools :nav-tools =" themeConfig.navTools" />
7444 </div >
75-
76- <div class =" text-b cursor-not-allowed" flex =" ~ center" >
77- <div class =" text-icon" >
78- <div i-tabler-search items-center />
79- </div >
80- </div >
81- </div >
45+ </slot >
8246 </div >
8347
8448 <div class =" search-placeholder-container absolute" w =" full" >
@@ -357,23 +321,4 @@ function toggle() {
357321 }
358322 }
359323}
360-
361- .text-icon {
362- display : flex ;
363- justify-content : center ;
364- align-items : center ;
365- width : 36px ;
366- height : 36px ;
367- color : var (--vp-c-text-2 );
368- transition : color 0.5s ;
369- }
370-
371- .text-b ::before {
372- margin-right : 8px ;
373- margin-left : 8px ;
374- width : 1px ;
375- height : 24px ;
376- background-color : var (--oceanus-c-divider );
377- content : ' ' ;
378- }
379324 </style >
0 commit comments