diff options
| author | Dania Rifki <atomicnumberphi@gmail.com> | 2026-02-23 15:59:21 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-23 16:02:39 +0800 |
| commit | 3cc069b21716445f49dcaaba130f122b1c4fe133 (patch) | |
| tree | daf53acbe803af341c8ab945ce7d32bf8e52239b /doc/docs | |
| parent | 760505c0639e9d6b2fc076512b9290622374ba86 (diff) | |
| download | yuescript-3cc069b21716445f49dcaaba130f122b1c4fe133.tar.gz yuescript-3cc069b21716445f49dcaaba130f122b1c4fe133.tar.bz2 yuescript-3cc069b21716445f49dcaaba130f122b1c4fe133.zip | |
Clickable hero image on homepage to navigate to the mascot reference page.
Diffstat (limited to 'doc/docs')
| -rw-r--r-- | doc/docs/.vitepress/theme/index.ts | 36 | ||||
| -rw-r--r-- | doc/docs/de/index.md | 1 | ||||
| -rw-r--r-- | doc/docs/id-id/index.md | 1 | ||||
| -rw-r--r-- | doc/docs/index.md | 1 | ||||
| -rw-r--r-- | doc/docs/pt-br/index.md | 1 | ||||
| -rw-r--r-- | doc/docs/zh/index.md | 1 |
6 files changed, 38 insertions, 3 deletions
diff --git a/doc/docs/.vitepress/theme/index.ts b/doc/docs/.vitepress/theme/index.ts index 70145d5..403b783 100644 --- a/doc/docs/.vitepress/theme/index.ts +++ b/doc/docs/.vitepress/theme/index.ts | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | import DefaultTheme from "vitepress/theme"; | 1 | import DefaultTheme from "vitepress/theme"; |
| 2 | import type { Theme } from "vitepress"; | 2 | import type { Theme } from "vitepress"; |
| 3 | import { h } from "vue"; | 3 | import { h } from "vue"; |
| 4 | import { useData, withBase } from "vitepress"; | ||
| 4 | import "./custom.css"; | 5 | import "./custom.css"; |
| 5 | 6 | ||
| 6 | // @ts-ignore | 7 | // @ts-ignore |
| @@ -14,10 +15,39 @@ import YueDisplay from "./components/YueDisplay.vue"; | |||
| 14 | 15 | ||
| 15 | const theme: Theme = { | 16 | const theme: Theme = { |
| 16 | extends: DefaultTheme, | 17 | extends: DefaultTheme, |
| 17 | Layout: () => | 18 | Layout: () => { |
| 18 | h(DefaultTheme.Layout, null, { | 19 | const { frontmatter } = useData(); |
| 20 | |||
| 21 | return h(DefaultTheme.Layout, null, { | ||
| 19 | "layout-bottom": () => [h(HomeFooter), h(CompilerModal)], | 22 | "layout-bottom": () => [h(HomeFooter), h(CompilerModal)], |
| 20 | }), | 23 | "home-hero-image": () => { |
| 24 | const fm = frontmatter.value; | ||
| 25 | if (fm?.hero?.image?.src) { | ||
| 26 | const img = h("img", { | ||
| 27 | src: withBase(fm.hero.image.src), | ||
| 28 | alt: fm.hero.image.alt || "", | ||
| 29 | class: "VPImage", | ||
| 30 | style: "max-width: 100%; max-height: 100%; object-fit: contain;", | ||
| 31 | }); | ||
| 32 | |||
| 33 | if (fm.hero.image.link) { | ||
| 34 | return h( | ||
| 35 | "a", | ||
| 36 | { | ||
| 37 | href: withBase(fm.hero.image.link), | ||
| 38 | class: "image-src", | ||
| 39 | style: "display: flex; justify-content: center; align-items: center;", | ||
| 40 | }, | ||
| 41 | [img] | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | |||
| 45 | return h("div", { class: "image-src", style: "display: flex; justify-content: center; align-items: center;" }, [img]); | ||
| 46 | } | ||
| 47 | return null; | ||
| 48 | }, | ||
| 49 | }); | ||
| 50 | }, | ||
| 21 | enhanceApp({ app }) { | 51 | enhanceApp({ app }) { |
| 22 | app.component("CompilerModal", CompilerModal); | 52 | app.component("CompilerModal", CompilerModal); |
| 23 | app.component("YueCompiler", YueCompiler); | 53 | app.component("YueCompiler", YueCompiler); |
diff --git a/doc/docs/de/index.md b/doc/docs/de/index.md index d9ebff0..bab0a91 100644 --- a/doc/docs/de/index.md +++ b/doc/docs/de/index.md | |||
| @@ -6,6 +6,7 @@ hero: | |||
| 6 | image: | 6 | image: |
| 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png | 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png |
| 8 | alt: YueScript | 8 | alt: YueScript |
| 9 | link: /de/doc/reference/mascot | ||
| 9 | actions: | 10 | actions: |
| 10 | - theme: brand | 11 | - theme: brand |
| 11 | text: Schnellstart → | 12 | text: Schnellstart → |
diff --git a/doc/docs/id-id/index.md b/doc/docs/id-id/index.md index feef760..5e1b31b 100644 --- a/doc/docs/id-id/index.md +++ b/doc/docs/id-id/index.md | |||
| @@ -6,6 +6,7 @@ hero: | |||
| 6 | image: | 6 | image: |
| 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png | 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png |
| 8 | alt: YueScript | 8 | alt: YueScript |
| 9 | link: /id-id/doc/reference/mascot | ||
| 9 | actions: | 10 | actions: |
| 10 | - theme: brand | 11 | - theme: brand |
| 11 | text: Mulai Cepat → | 12 | text: Mulai Cepat → |
diff --git a/doc/docs/index.md b/doc/docs/index.md index 7d34f11..e6b5cfe 100644 --- a/doc/docs/index.md +++ b/doc/docs/index.md | |||
| @@ -6,6 +6,7 @@ hero: | |||
| 6 | image: | 6 | image: |
| 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png | 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png |
| 8 | alt: YueScript | 8 | alt: YueScript |
| 9 | link: /doc/reference/mascot | ||
| 9 | actions: | 10 | actions: |
| 10 | - theme: brand | 11 | - theme: brand |
| 11 | text: Quick Start → | 12 | text: Quick Start → |
diff --git a/doc/docs/pt-br/index.md b/doc/docs/pt-br/index.md index ce0a516..3a94715 100644 --- a/doc/docs/pt-br/index.md +++ b/doc/docs/pt-br/index.md | |||
| @@ -6,6 +6,7 @@ hero: | |||
| 6 | image: | 6 | image: |
| 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png | 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png |
| 8 | alt: YueScript | 8 | alt: YueScript |
| 9 | link: /pt-br/doc/reference/mascot | ||
| 9 | actions: | 10 | actions: |
| 10 | - theme: brand | 11 | - theme: brand |
| 11 | text: Início rápido → | 12 | text: Início rápido → |
diff --git a/doc/docs/zh/index.md b/doc/docs/zh/index.md index 0146468..75f0eff 100644 --- a/doc/docs/zh/index.md +++ b/doc/docs/zh/index.md | |||
| @@ -6,6 +6,7 @@ hero: | |||
| 6 | image: | 6 | image: |
| 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png | 7 | src: /image/mascot/electrichearts_20260211A_yuescript_xiaoyu.png |
| 8 | alt: 月之脚本 | 8 | alt: 月之脚本 |
| 9 | link: /zh/doc/reference/mascot | ||
| 9 | actions: | 10 | actions: |
| 10 | - theme: brand | 11 | - theme: brand |
| 11 | text: 快速上手 → | 12 | text: 快速上手 → |
