Quellcode durchsuchen

[site]更新.gitignore,移除App.svelte中的文档提示,Header组件添加版本选择功能

dufu1991 vor 1 Jahr
Ursprung
Commit
0ec34325f1
3 geänderte Dateien mit 34 neuen und 13 gelöschten Zeilen
  1. 6 0
      .gitignore
  2. 0 12
      site/src/App.svelte
  3. 28 1
      site/src/components/header/Header.svelte

+ 6 - 0
.gitignore

@@ -3,6 +3,12 @@
 
 bun.lockb
 
+node_modules
+.svelte-kit
+build
+bun.lock
+dist
+
 .DS_Store
 /node_modules
 pnpm-lock.yaml

+ 0 - 12
site/src/App.svelte

@@ -45,18 +45,6 @@
 </svelte:head>
 
 <main class="bg-primaryWhite dark:bg-darkBlack text-black dark:text-white relative min-h-screen text-justify antialiased">
-	<!-- main -> next -->
-	{#if $location === '' || $location === '/'}
-		<div class="bg-primary dark:bg-dark px-2 py-1 text-center text-xs text-white dark:text-black">
-			{#if isZh}
-				这是 v0.x 文档,v1.0.0@next 请访问 <a href="https://next.stdf.design" class="underline" target="_blank">next.stdf.design</a>
-			{:else}
-				This is the v0.x documentation, please visit <a href="https://next.stdf.design" class="underline" target="_blank">
-					next.stdf.design
-				</a> for v1.0.0@next
-			{/if}
-		</div>
-	{/if}
 	<Header {showLeftNav} showBottonLine={!isHome} on:clickCmdK={headerCmdKFun} />
 	<Router {routes} />
 	<CmdK />

+ 28 - 1
site/src/components/header/Header.svelte

@@ -52,6 +52,7 @@
 			showThemeSwitchStore.set(false);
 		}
 	});
+	let showVersion = false;
 </script>
 
 <div
@@ -96,7 +97,33 @@
 				</svg>
 			</div>
 		</a>
-		<span class="text-primary dark:text-dark text-sm">v0.x</span>
+		<!-- 下拉选项,选择版本 -->
+		{#if window.location.pathname === '' || window.location.pathname === '/'}
+			<div class="relative bottom-1">
+				<button class="flex rounded bg-black/5 py-0.5 pl-2 pr-4 text-sm dark:bg-white/20" on:click={() => (showVersion = !showVersion)}>
+					v0
+					<span class="absolute bottom-0.5 left-5 w-4 text-gray-500">
+						<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
+							<path d="M12 15.0006L7.75732 10.758L9.17154 9.34375L12 12.1722L14.8284 9.34375L16.2426 10.758L12 15.0006Z"></path>
+						</svg>
+					</span>
+				</button>
+				{#if showVersion}
+					<div class="absolute left-0 top-8 w-12 rounded-md bg-white p-1 text-xs shadow-md dark:bg-black dark:shadow-white/10">
+						<a href="https://stdf.design" target="_blank" class="block rounded px-2 py-0.5 hover:bg-black/5 dark:hover:bg-white/20"> v1 </a>
+						<a href="/" class="relative flex rounded py-0.5 pl-2 hover:bg-black/5 dark:hover:bg-white/20"
+							>v0
+							<span class="absolute bottom-0.5 left-4 ml-2 w-3 mt-2">
+								<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
+									<path d="M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"
+									></path>
+								</svg>
+							</span>
+						</a>
+					</div>
+				{/if}
+			</div>
+		{/if}
 	</div>
 	<div>
 		<div class="cursor-pointer md:hidden p-4">