Skip to content

Commit 5fa9769

Browse files
committed
docs(guide): add promo video and update component
1 parent daf1df9 commit 5fa9769

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

apps/docs/.vitepress/theme/components/HomePromoVideo.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@ import { useData, withBase } from 'vitepress'
33
import { computed, onMounted, ref, watch } from 'vue'
44
55
const { lang } = useData()
6+
withDefaults(defineProps<{ variant?: 'home' | 'doc' }>(), {
7+
variant: 'home',
8+
})
9+
610
const videoRef = ref<HTMLVideoElement>()
711
812
const videoSrc = computed(() =>
913
withBase(lang.value.startsWith('zh') ? '/protocol-launcher-promo.zh.mp4' : '/protocol-launcher-promo.en.mp4'),
1014
)
1115
16+
const ariaLabel = computed(() =>
17+
lang.value.startsWith('zh') ? 'Protocol Launcher 宣传视频' : 'Protocol Launcher promo video',
18+
)
19+
1220
const playVideo = () => {
1321
if (!videoRef.value) {
1422
return
@@ -30,7 +38,7 @@ watch(videoSrc, () => {
3038
</script>
3139

3240
<template>
33-
<section class="HomePromoVideo" aria-label="Protocol Launcher promo video">
41+
<section class="HomePromoVideo" :class="`HomePromoVideo--${variant}`" :aria-label="ariaLabel">
3442
<div class="container">
3543
<video ref="videoRef" :src="videoSrc" autoplay muted loop playsinline preload="metadata" />
3644
</div>
@@ -68,4 +76,12 @@ video {
6876
padding: 16px 64px 32px;
6977
}
7078
}
79+
80+
.HomePromoVideo--doc {
81+
padding: 16px 0 24px;
82+
}
83+
84+
.HomePromoVideo--doc .container {
85+
max-width: 100%;
86+
}
7187
</style>

apps/docs/en/guide/what-is-it.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
layout: doc
33
---
44

5+
<script setup lang="ts">
6+
import HomePromoVideo from '../../.vitepress/theme/components/HomePromoVideo.vue';
7+
</script>
8+
59
# What is Protocol Launcher?
610

711
**Protocol Launcher** is a TypeScript library designed to generate "Quick Launch" URLs (Deep Links) for various applications.
812

913
These URLs allow users to trigger specific actions in applications with a single click, such as installing plugins, configuring servers, or setting up API keys.
1014

15+
<HomePromoVideo variant="doc" />
16+
1117
## Key Features
1218

1319
- **Type-Safe**: Strict TypeScript types validate payloads and prevent malformed links.

apps/docs/zh/guide/what-is-it.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
layout: doc
33
---
44

5+
<script setup lang="ts">
6+
import HomePromoVideo from '../../.vitepress/theme/components/HomePromoVideo.vue';
7+
</script>
8+
59
# 什么是 Protocol Launcher?
610

711
**Protocol Launcher** 是一个 TypeScript 库,旨在为各种应用程序生成“快速启动” URL(深度链接)。
812

913
这些 URL 允许用户通过单击触发应用程序中的特定操作,例如安装插件、配置服务器或设置 API 密钥。
1014

15+
<HomePromoVideo variant="doc" />
16+
1117
## 主要特性
1218

1319
- **类型安全**: 严格的 TypeScript 类型校验,避免生成不合法链接。

0 commit comments

Comments
 (0)