diff --git a/docs/.vuepress/public/images/custom-banner.jpg b/docs/.vuepress/public/images/custom-banner.jpg new file mode 100644 index 00000000..cae6c891 Binary files /dev/null and b/docs/.vuepress/public/images/custom-banner.jpg differ diff --git a/docs/.vuepress/public/images/custom-banner.png b/docs/.vuepress/public/images/custom-banner.png deleted file mode 100644 index c0f7b4a7..00000000 Binary files a/docs/.vuepress/public/images/custom-banner.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-content.jpg b/docs/.vuepress/public/images/custom-content.jpg new file mode 100644 index 00000000..22fc5fb9 Binary files /dev/null and b/docs/.vuepress/public/images/custom-content.jpg differ diff --git a/docs/.vuepress/public/images/custom-content.png b/docs/.vuepress/public/images/custom-content.png deleted file mode 100644 index f3f62805..00000000 Binary files a/docs/.vuepress/public/images/custom-content.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-doc-hero.jpg b/docs/.vuepress/public/images/custom-doc-hero.jpg new file mode 100644 index 00000000..d08c5b6a Binary files /dev/null and b/docs/.vuepress/public/images/custom-doc-hero.jpg differ diff --git a/docs/.vuepress/public/images/custom-features.jpg b/docs/.vuepress/public/images/custom-features.jpg new file mode 100644 index 00000000..1d487d63 Binary files /dev/null and b/docs/.vuepress/public/images/custom-features.jpg differ diff --git a/docs/.vuepress/public/images/custom-features.png b/docs/.vuepress/public/images/custom-features.png deleted file mode 100644 index 12e8225c..00000000 Binary files a/docs/.vuepress/public/images/custom-features.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-hero.jpg b/docs/.vuepress/public/images/custom-hero.jpg new file mode 100644 index 00000000..a45e5c09 Binary files /dev/null and b/docs/.vuepress/public/images/custom-hero.jpg differ diff --git a/docs/.vuepress/public/images/custom-hero.png b/docs/.vuepress/public/images/custom-hero.png deleted file mode 100644 index 89ab2d47..00000000 Binary files a/docs/.vuepress/public/images/custom-hero.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-image-text.jpg b/docs/.vuepress/public/images/custom-image-text.jpg new file mode 100644 index 00000000..332fe7bd Binary files /dev/null and b/docs/.vuepress/public/images/custom-image-text.jpg differ diff --git a/docs/.vuepress/public/images/custom-image-text.png b/docs/.vuepress/public/images/custom-image-text.png deleted file mode 100644 index 9b2f0d1b..00000000 Binary files a/docs/.vuepress/public/images/custom-image-text.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-profile.jpg b/docs/.vuepress/public/images/custom-profile.jpg new file mode 100644 index 00000000..c0f5f279 Binary files /dev/null and b/docs/.vuepress/public/images/custom-profile.jpg differ diff --git a/docs/.vuepress/public/images/custom-profile.png b/docs/.vuepress/public/images/custom-profile.png deleted file mode 100644 index e67db886..00000000 Binary files a/docs/.vuepress/public/images/custom-profile.png and /dev/null differ diff --git a/docs/.vuepress/public/images/custom-text-image.jpg b/docs/.vuepress/public/images/custom-text-image.jpg new file mode 100644 index 00000000..6988c659 Binary files /dev/null and b/docs/.vuepress/public/images/custom-text-image.jpg differ diff --git a/docs/.vuepress/public/images/custom-text-image.png b/docs/.vuepress/public/images/custom-text-image.png deleted file mode 100644 index ea01e2ce..00000000 Binary files a/docs/.vuepress/public/images/custom-text-image.png and /dev/null differ diff --git a/docs/notes/theme/guide/markdown/示例容器.md b/docs/notes/theme/guide/markdown/示例容器.md index e53899c0..08d93502 100644 --- a/docs/notes/theme/guide/markdown/示例容器.md +++ b/docs/notes/theme/guide/markdown/示例容器.md @@ -32,13 +32,13 @@ outline: 2 ```md ::: demo-wrapper img no-padding -![hero](/images/custom-hero.png) +![hero](/images/custom-hero.jpg) ::: ``` **输出:** ::: demo-wrapper img no-padding -![hero](/images/custom-hero.png) +![hero](/images/custom-hero.jpg) ::: 包含 markdown 语法: diff --git a/docs/notes/theme/guide/自定义首页.md b/docs/notes/theme/guide/自定义首页.md index 985bb9f9..32231d78 100644 --- a/docs/notes/theme/guide/自定义首页.md +++ b/docs/notes/theme/guide/自定义首页.md @@ -135,7 +135,7 @@ config: **效果:** :::demo-wrapper img no-padding - + ::: ### hero @@ -225,7 +225,7 @@ config: **效果:** :::demo-wrapper img no-padding -Theme Plume +Theme Plume ::: 当 `background` 配置为 `tint-plate` 时,还可以额外配置 `tintPlate` 调整 背景色调,范围为 `0 ~ 255`: @@ -262,13 +262,89 @@ config: /* 默认设置,可以在 `index.css` 中覆盖 */ :root { /* home hero name 背景色,通过背景色裁剪的方式定义文本颜色, - 因此,可以设置渐变背景的方式使文本根据表现力 */ + 因此,可以设置渐变背景的方式使文本更具表现力 */ --vp-bg-home-hero-name: linear-gradient(315deg, var(--vp-c-purple-1) 15%, var(--vp-c-brand-2) 65%, var(--vp-c-brand-2) 100%); --vp-c-home-hero-tagline: var(--vp-c-text-2); --vp-c-home-hero-text: var(--vp-c-text-3); } ``` +### doc-hero + +- 类型: `PlumeThemeHomeDocHero` + +适用于 文档 类型站点,放置于 首位。 + +```ts +interface PlumeThemeHomeDocHero { + type: 'doc-hero' + hero: { + name: string + tagline?: string + text?: string + image?: string + | { src: string, alt?: string } + | { dark: string, light: string, alt?: string } + actions?: { + theme?: 'brand' | 'alt' | 'sponsor' + text: string + link?: string + icon?: string // 文本左侧图标 + suffixIcon?: string // 文本右侧图标 + target?: '_blank' | '_self' | string + rel?: string + } + } +} +``` + +**示例:** + +```md +--- +home: true +config: + - + type: doc-hero + hero: + name: Theme Plume + text: VuePress Next Theme + tagline: 一个简约易用的,功能丰富的 vuepress 文档&博客 主题 + image: /plume.png + actions: + - + theme: brand + text: 快速开始 → + link: /guide/intro/ + - + theme: alt + text: Github + link: https://github.com/pengzhanbo/vuepress-theme-plume +--- +``` + +**效果:** + +:::demo-wrapper img no-padding +Theme Plume +::: + +主题还支持自定义 `name`, `tagline`, `text` 的颜色,以及 `image` 的背景色。 + +通过 `CSS Vars` 进行配置。 + +```css +/* 默认设置,可以在 `index.css` 中覆盖 */ +:root { + --vp-home-hero-name-color: transparent; + --vp-home-hero-name-background: linear-gradient(120deg, var(--vp-c-purple-1) 30%, var(--vp-c-brand-2)); + --vp-home-hero-tagline: var(--vp-c-text-2); + --vp-home-hero-text: var(--vp-c-text-1); + --vp-home-hero-image-background-image: linear-gradient(-45deg, var(--vp-c-brand-soft) 50%, var(--vp-c-brand-2) 50%); + --vp-home-hero-image-filter: blur(44px); +} +``` + ### features - 类型: `PlumeThemeHomeFeatures` @@ -363,7 +439,7 @@ config: **效果:** :::demo-wrapper img no-padding - + ::: ### text-image | image-text @@ -436,11 +512,11 @@ config: **效果:** :::demo-wrapper img no-padding -image-text +image-text ::: :::demo-wrapper img no-padding -text-image +text-image ::: ### blog @@ -485,7 +561,7 @@ config: **效果:** :::demo-wrapper img no-padding -profile +profile ::: ### custom @@ -531,7 +607,7 @@ yarn add vuepress@next vuepress-theme-plume **效果:** :::demo-wrapper img no-padding -content +content ::: ## 自定义区域类型 diff --git a/theme/src/client/components/Home/VPHome.vue b/theme/src/client/components/Home/VPHome.vue index 3dff8337..fe4e4da6 100644 --- a/theme/src/client/components/Home/VPHome.vue +++ b/theme/src/client/components/Home/VPHome.vue @@ -3,6 +3,7 @@ import type { Component } from 'vue' import VPBlog from '@theme/Blog/VPBlog.vue' import VPHomeBanner from '@theme/Home/VPHomeBanner.vue' import VPHomeCustom from '@theme/Home/VPHomeCustom.vue' +import VPHomeDocHero from '@theme/Home/VPHomeDocHero.vue' import VPHomeFeatures from '@theme/Home/VPHomeFeatures.vue' import VPHomeHero from '@theme/Home/VPHomeHero.vue' import VPHomeProfile from '@theme/Home/VPHomeProfile.vue' @@ -31,6 +32,7 @@ function VPHomeBlog() { const components: Record> = { 'banner': VPHomeBanner, 'hero': VPHomeHero, + 'doc-hero': VPHomeDocHero, 'features': VPHomeFeatures, 'text-image': VPHomeTextImage, 'image-text': VPHomeTextImage, diff --git a/theme/src/client/components/Home/VPHomeDocHero.vue b/theme/src/client/components/Home/VPHomeDocHero.vue new file mode 100644 index 00000000..2e8d374a --- /dev/null +++ b/theme/src/client/components/Home/VPHomeDocHero.vue @@ -0,0 +1,334 @@ + + + + + diff --git a/theme/src/client/components/Home/VPHomeHero.vue b/theme/src/client/components/Home/VPHomeHero.vue index 982276e8..e27393fe 100644 --- a/theme/src/client/components/Home/VPHomeHero.vue +++ b/theme/src/client/components/Home/VPHomeHero.vue @@ -172,8 +172,10 @@ useHomeHeroTintPlate( .action { display: flex; - gap: 24px; + flex-wrap: wrap; + gap: 16px 24px; align-items: center; + justify-content: center; } .action :deep(.vp-button) { diff --git a/theme/src/shared/frontmatter/home.ts b/theme/src/shared/frontmatter/home.ts index 756cac7c..a8c980e5 100644 --- a/theme/src/shared/frontmatter/home.ts +++ b/theme/src/shared/frontmatter/home.ts @@ -16,6 +16,10 @@ export interface PlumeThemeHero { actions: PlumeThemeHeroAction[] } +export interface PlumeThemeDocHero extends PlumeThemeHero { + image?: ThemeImage +} + export interface PlumeThemeHeroAction { theme?: 'brand' | 'alt' text: string @@ -27,7 +31,7 @@ export interface PlumeThemeHeroAction { } export interface PlumeHomeConfigBase { - type: 'banner' | 'hero' | 'text-image' | 'image-text' | 'features' | 'profile' | 'custom' + type: 'banner' | 'hero' | 'doc-hero' | 'text-image' | 'image-text' | 'features' | 'profile' | 'custom' full?: boolean backgroundImage?: string | { light: string, dark: string } backgroundAttachment?: 'fixed' | 'local' @@ -60,6 +64,11 @@ export interface PlumeThemeHomeHero extends PlumeHomeConfigBase { filter?: string } +export interface PlumeThemeHomeDocHero extends PlumeHomeConfigBase { + type: 'doc-hero' + hero: PlumeThemeDocHero +} + export interface PlumeThemeHomeTextImage extends PlumeHomeConfigBase { type: 'text-image' | 'image-text' image: ThemeImage