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