|
1 | 1 | <script setup lang="ts"> |
2 | | -import { ref } from 'vue'; |
3 | | -import { useRouter } from 'vue-router'; |
4 | | -import { SButton, SDrawer, SIcon } from '@soybeanjs/ui'; |
| 2 | +import { shallowRef } from 'vue'; |
5 | 3 | import { useI18n } from 'vue-i18n'; |
6 | 4 | import pkg from '../../package.json' with { type: 'json' }; |
7 | 5 | import ToolBar from './tool-bar.vue'; |
8 | 6 |
|
9 | | -const router = useRouter(); |
10 | 7 | const { t } = useI18n(); |
11 | | -const drawerVisible = ref(false); |
12 | 8 |
|
13 | | -function goHome() { |
14 | | - router.push('/'); |
15 | | -} |
| 9 | +const drawerVisible = shallowRef(false); |
16 | 10 | </script> |
17 | 11 |
|
18 | 12 | <template> |
19 | 13 | <header |
20 | 14 | class="fixed top-0 left-0 right-0 z-50 bg-white/80 dark:bg-gray-950/80 backdrop-blur-md border-b border-gray-200/50 dark:border-gray-800/50 transition-all duration-300" |
21 | 15 | > |
22 | 16 | <div class="flex items-center justify-between px-6 py-3 max-w-[1440px] mx-auto h-full"> |
23 | | - <!-- Left Section: Logo, Title, Search --> |
24 | 17 | <div class="flex items-center gap-8"> |
25 | | - <!-- Logo & Title --> |
26 | | - <div class="flex items-center gap-3 cursor-pointer group" @click="goHome"> |
| 18 | + <SLink to="/" class="group flex items-center gap-3"> |
27 | 19 | <img src="/logo.svg" alt="Logo" class="size-8 transition-transform duration-300 group-hover:scale-110" /> |
28 | 20 | <h1 |
29 | | - class="text-lg font-bold bg-clip-text text-transparent bg-gradient-to-r from-primary-600 to-primary dark:from-primary dark:to-primary-300 hidden sm:block" |
| 21 | + class="text-lg font-bold bg-clip-text text-transparent whitespace-nowrap bg-gradient-to-r from-primary-600 to-primary dark:from-primary dark:to-primary-300" |
30 | 22 | > |
31 | 23 | {{ t('components.home.title') }} |
32 | 24 | </h1> |
33 | | - </div> |
34 | | - |
35 | | - <!-- Search Box (Placeholder) --> |
36 | | - <div |
37 | | - class="hidden md:flex items-center gap-2 px-3 py-1.5 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-400 dark:text-gray-500 text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors w-64" |
38 | | - > |
39 | | - <SIcon icon="lucide:search" class="text-base" /> |
40 | | - <span>{{ t('layout.header.search') }}</span> |
41 | | - <span class="ml-auto text-xs border border-gray-300 dark:border-gray-600 rounded px-1">⌘K</span> |
42 | | - </div> |
43 | | - </div> |
44 | | - |
45 | | - <!-- Right Section: Menu, Version, Tools --> |
46 | | - <div class="flex items-center gap-6"> |
47 | | - <!-- Desktop Navigation --> |
48 | | - <nav class="hidden md:flex items-center gap-6"> |
49 | | - <a |
50 | | - href="#" |
51 | | - class="text-sm font-medium text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors" |
52 | | - > |
53 | | - {{ t('layout.header.docs') }} |
54 | | - </a> |
55 | | - <RouterLink |
56 | | - to="/components/button" |
57 | | - class="text-sm font-medium text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors" |
58 | | - active-class="text-primary dark:text-primary font-semibold" |
59 | | - > |
60 | | - {{ t('layout.header.components') }} |
61 | | - </RouterLink> |
62 | | - </nav> |
63 | | - |
64 | | - <!-- Version --> |
65 | | - <div |
66 | | - class="hidden md:block text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded-full" |
67 | | - > |
68 | | - {{ pkg.version }} |
69 | | - </div> |
70 | | - |
71 | | - <!-- Tools --> |
72 | | - <div class="hidden md:flex items-center gap-2 pl-2 border-l border-gray-200 dark:border-gray-800"> |
73 | | - <a |
74 | | - href="https://github.com/soybeanjs/soybean-ui" |
75 | | - target="_blank" |
76 | | - rel="noopener noreferrer" |
77 | | - class="p-2 text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800" |
78 | | - > |
79 | | - <SIcon icon="mdi:github" class="text-xl" /> |
80 | | - </a> |
81 | | - <ToolBar /> |
82 | | - </div> |
83 | | - |
84 | | - <!-- Mobile Menu Toggle --> |
85 | | - <div class="md:!hidden flex items-center gap-2"> |
86 | | - <SButton variant="ghost" class="!p-2 size-9 rounded-full" @click="drawerVisible = true"> |
87 | | - <SIcon icon="lucide:menu" class="text-xl" /> |
88 | | - </SButton> |
89 | | - </div> |
| 25 | + </SLink> |
| 26 | + <SearchDocument class="lt-md:!hidden [&_.placeholder]:lt-lg:hidden" /> |
90 | 27 | </div> |
91 | | - </div> |
92 | | - |
93 | | - <!-- Mobile Drawer --> |
94 | | - <SDrawer v-model:open="drawerVisible" placement="right" class="w-64 p-4"> |
95 | | - <div class="flex flex-col gap-6 mt-6"> |
96 | | - <!-- Mobile Search --> |
97 | | - <div |
98 | | - class="flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-400 dark:text-gray-500 text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors" |
99 | | - > |
100 | | - <SIcon icon="lucide:search" class="text-base" /> |
101 | | - <span>{{ t('layout.header.search') }}</span> |
102 | | - </div> |
103 | | - |
104 | | - <!-- Mobile Navigation --> |
105 | | - <nav class="flex flex-col gap-4"> |
106 | | - <a |
107 | | - href="#" |
108 | | - class="text-base font-medium text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors" |
109 | | - > |
110 | | - {{ t('layout.header.docs') }} |
111 | | - </a> |
112 | | - <RouterLink |
113 | | - to="/components/button" |
114 | | - class="text-base font-medium text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors" |
115 | | - active-class="text-primary dark:text-primary font-semibold" |
116 | | - @click="drawerVisible = false" |
117 | | - > |
118 | | - {{ t('layout.header.components') }} |
119 | | - </RouterLink> |
120 | | - </nav> |
121 | 28 |
|
122 | | - <div class="h-px bg-gray-200 dark:bg-gray-800 my-2"></div> |
123 | | - |
124 | | - <!-- Mobile Tools --> |
125 | | - <div class="flex flex-col gap-4"> |
126 | | - <div class="flex items-center justify-between"> |
127 | | - <span class="text-sm text-gray-500">{{ t('layout.header.version') }}</span> |
128 | | - <span |
129 | | - class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded-full" |
130 | | - > |
131 | | - v0.0.1 |
132 | | - </span> |
133 | | - </div> |
134 | | - <div class="flex items-center justify-between"> |
135 | | - <span class="text-sm text-gray-500">{{ t('layout.header.github') }}</span> |
136 | | - <a |
137 | | - href="https://github.com/soybeanjs/soybean-ui" |
138 | | - target="_blank" |
139 | | - rel="noopener noreferrer" |
140 | | - class="text-gray-600 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors" |
141 | | - > |
142 | | - <SIcon icon="mdi:github" class="text-xl" /> |
143 | | - </a> |
144 | | - </div> |
145 | | - <div class="flex items-center justify-between"> |
146 | | - <span class="text-sm text-gray-500">{{ t('layout.header.theme_language') }}</span> |
| 29 | + <div class="flex items-center gap-4"> |
| 30 | + <HeaderNav class="lt-md:!hidden" /> |
| 31 | + <STag size="lg" variant="soft" color="carbon" shape="rounded" class="lt-md:!hidden">v{{ pkg.version }}</STag> |
| 32 | + <SSeparator orientation="vertical" class="h-8 lt-md:!hidden" /> |
| 33 | + <ToolBar class="lt-md:!hidden" /> |
| 34 | + |
| 35 | + <!-- Mobile Drawer --> |
| 36 | + <SDrawer v-model:open="drawerVisible" placement="right"> |
| 37 | + <template #trigger> |
| 38 | + <SButtonIcon icon="lucide:menu" class="md:!hidden text-xl" /> |
| 39 | + </template> |
| 40 | + <div class="flex flex-col gap-4 pt-4"> |
| 41 | + <SearchDocument data-mobile class="w-full" /> |
| 42 | + <HeaderNav orientation="vertical" /> |
| 43 | + <SSeparator /> |
147 | 44 | <ToolBar /> |
148 | 45 | </div> |
149 | | - </div> |
| 46 | + </SDrawer> |
150 | 47 | </div> |
151 | | - </SDrawer> |
| 48 | + </div> |
152 | 49 | </header> |
153 | 50 | </template> |
0 commit comments