Skip to content

Harness engineering beginner tutorial, from 0 to 1

Fix docs navigation and branding issues

sanbuphydd29a755466c
diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts
index 7e250ee..b47a201 100644
--- a/docs/.vitepress/config.mts
+++ b/docs/.vitepress/config.mts
@@ -3,6 +3,7 @@ import { defineConfig } from "vitepress";
import { withMermaid } from "vitepress-plugin-mermaid";
const docsBase = "/learn-harness-engineering/";
+const starLogo = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23F5C542" stroke="%23D49B00" stroke-width="1.2" d="M12 2.8l2.68 5.43 5.99.87-4.34 4.23 1.02 5.97L12 16.64 6.65 19.3l1.02-5.97-4.34-4.23 5.99-.87L12 2.8Z"/></svg>';
const zhLectureItems = [
{ text: "欢迎", link: "/zh/" },
@@ -84,10 +85,10 @@ export default withMermaid(
srcExclude: ["temp/**"],
ignoreDeadLinks: true,
head: [
- ['link', { rel: 'icon', type: 'image/svg+xml', href: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="4" fill="%23FFFFFF" /><path d="M12 4L13.4 8.6L18 10L13.4 11.4L12 16L10.6 11.4L6 10L10.6 8.6L12 4Z" fill="%23D95C41"/></svg>' }]
+ ['link', { rel: 'icon', type: 'image/svg+xml', href: starLogo }]
],
themeConfig: {
- logo: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="4" fill="%231A1A1A" /><path d="M12 4L13.4 8.6L18 10L13.4 11.4L12 16L10.6 11.4L6 10L10.6 8.6L12 4Z" fill="%23D95C41"/></svg>',
+ logo: starLogo,
search: {
provider: "local"
},
@@ -113,6 +114,12 @@ export default withMermaid(
root: {
label: "English",
lang: "en",
+ link: "/en/"
+ },
+ en: {
+ label: "English",
+ lang: "en",
+ link: "/en/",
themeConfig: {
nav: [
{ text: "Lectures", link: enLectureItems[1].link, activeMatch: '^/en/(lectures/.*)?$' },
@@ -140,32 +147,27 @@ export default withMermaid(
{ text: "Try Harness ↗", link: "https://github.com/walkinglabs/learn-harness-engineering/blob/main/docs/zh/resources/templates/index.md", target: "_blank", rel: "noopener noreferrer" }
],
sidebar: {
- '/zh/projects/': [{ text: "项目", items: zhProjectItems }],
- '/zh/resources/': [{ text: "资料库", items: zhResourceItems }],
- '/zh/': [{ text: "讲义", items: zhLectureItems }]
- },
- outline: {
- level: [2, 3]
- },
- docFooter: {
- prev: "上一篇",
- next: "下一篇"
- },
- lastUpdated: {
- text: "最后更新于"
- },
- returnToTopLabel: "回到顶部",
- sidebarMenuLabel: "菜单",
- darkModeSwitchLabel: "主题",
- lightModeSwitchTitle: "切换到浅色模式",
- darkModeSwitchTitle: "切换到深色模式",
- socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]
+ '/zh/projects/': [{ text: "项目", items: zhProjectItems }],
+ '/zh/resources/': [{ text: "资料库", items: zhResourceItems }],
+ '/zh/': [{ text: "讲义", items: zhLectureItems }]
+ },
+ outline: {
+ level: [2, 3]
+ },
+ docFooter: {
+ prev: "上一篇",
+ next: "下一篇"
+ },
+ lastUpdated: {
+ text: "最后更新于"
+ },
+ returnToTopLabel: "回到顶部",
+ sidebarMenuLabel: "菜单",
+ darkModeSwitchLabel: "主题",
+ lightModeSwitchTitle: "切换到浅色模式",
+ darkModeSwitchTitle: "切换到深色模式",
+ socialLinks: [{ icon: "github", link: "https://github.com/walkinglabs/learn-harness-engineering" }]
+ }
}
- },
- en: {
- label: "English",
- lang: "en",
- link: "/en/"
}
- }
}));
diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js
index c697345..f1df937 100644
--- a/docs/.vitepress/theme/index.js
+++ b/docs/.vitepress/theme/index.js
@@ -1,9 +1,19 @@
import DefaultTheme from 'vitepress/theme'
import './style.css'
+let rootEnglishLabel = 'English'
+
function syncRootLocaleLabel(siteData, href = '') {
const locales = siteData.value?.locales
- if (!locales?.root || !locales.en || !locales.zh) return
+ if (!locales?.root || !locales?.zh) return
+
+ if (locales.root.label && locales.root.label !== locales.zh.label) {
+ rootEnglishLabel = locales.root.label
+ }
+
+ if (locales.en?.label) {
+ rootEnglishLabel = locales.en.label
+ }
const base = siteData.value.base || '/'
const normalized = href || (typeof window !== 'undefined' ? window.location.pathname : '')
@@ -11,7 +21,7 @@ function syncRootLocaleLabel(siteData, href = '') {
? normalized.slice(base.length - 1)
: normalized
- locales.root.label = relative.startsWith('/en/') ? locales.en.label : locales.zh.label
+ locales.root.label = relative.startsWith('/zh/') ? locales.zh.label : rootEnglishLabel
}
export default {
diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css
index e164284..7971329 100644
--- a/docs/.vitepress/theme/style.css
+++ b/docs/.vitepress/theme/style.css
@@ -253,6 +253,79 @@
background-color: rgba(255, 255, 255, 0.08) !important;
}
+@media (min-width: 768px) and (max-width: 959px) {
+ .VPNavBar.has-sidebar .container {
+ max-width: 100%;
+ }
+
+ .VPNavBar.has-sidebar .title {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 2;
+ padding: 0 32px;
+ width: var(--vp-sidebar-width);
+ height: var(--vp-nav-height);
+ background-color: transparent;
+ }
+
+ .VPNavBar.has-sidebar .content {
+ position: relative;
+ z-index: 1;
+ padding-right: 32px;
+ padding-left: var(--vp-sidebar-width);
+ }
+
+ .VPNavBar.has-sidebar .divider {
+ padding-left: var(--vp-sidebar-width);
+ }
+
+ .VPNavBar:not(.home.top) .content-body {
+ position: relative;
+ background-color: var(--vp-nav-bg-color);
+ }
+
+ .VPNavBar:not(.has-sidebar):not(.home.top) .content-body {
+ background-color: transparent;
+ }
+
+ .VPContent {
+ padding-top: var(--vp-nav-height);
+ }
+
+ .VPContent.has-sidebar {
+ margin: var(--vp-layout-top-height, 0px) 0 0;
+ padding-left: var(--vp-sidebar-width);
+ }
+
+ .VPSidebar {
+ z-index: 25;
+ padding-top: var(--vp-nav-height);
+ width: var(--vp-sidebar-width);
+ max-width: 100%;
+ opacity: 1;
+ visibility: visible;
+ box-shadow: none;
+ transform: translateX(0);
+ }
+
+ .VPSidebar .curtain {
+ position: sticky;
+ top: -64px;
+ left: 0;
+ z-index: 1;
+ margin-top: calc(var(--vp-nav-height) * -1);
+ margin-right: -32px;
+ margin-left: -32px;
+ height: var(--vp-nav-height);
+ background-color: var(--vp-sidebar-bg-color);
+ }
+
+ .VPLocalNav {
+ display: none;
+ }
+}
+
/* ---------- Navigation ---------- */
.VPNav {
background-color: var(--vp-nav-bg-color);
@@ -264,29 +337,31 @@
}
.VPNavBarTitle {
- font-family: 'Newsreader', serif;
- font-size: 1.25rem;
+ font-family: 'Newsreader', ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
+ font-size: 1.45rem;
font-weight: 500;
+ letter-spacing: -0.01em;
color: var(--vp-c-text-1);
}
.VPNavBarTitle .title {
display: flex;
align-items: center;
- gap: 8px;
+ gap: 10px;
}
/* Nav Logo Fix */
.VPNavBarTitle .logo {
- height: 24px;
- width: 24px;
- margin-right: 6px;
- border-radius: 4px;
+ height: 28px;
+ width: 28px;
+ margin-right: 2px;
+ border-radius: 0;
}
-.dark .VPNavBarTitle .logo {
- filter: invert(1);
+.VPNavBarMenu {
+ align-items: center;
}
+
.VPNavBarMenuLink {
position: relative;
color: var(--vp-c-text-2) !important;
@@ -308,11 +383,13 @@
border-radius: 20px !important;
padding: 0 16px !important;
margin: 0 4px 0 12px !important;
- height: 32px !important;
+ height: 36px !important;
+ line-height: 1 !important;
transition: background-color 0.2s ease;
display: flex !important;
align-items: center;
justify-content: center;
+ align-self: center;
}
.VPNavBarMenuLink[href*="learn-harness-engineering/blob/main/docs/"]:hover {