@rxdrag/website-lib 0.0.103 → 0.0.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/components/AnimationNumber.astro +0 -218
- package/src/components/Background.astro +0 -106
- package/src/components/BackgroundGroup.astro +0 -21
- package/src/components/Box.astro +0 -25
- package/src/components/Collapse.astro +0 -125
- package/src/components/CollapseIndicator.astro +0 -20
- package/src/components/Container.astro +0 -13
- package/src/components/Dialog.astro +0 -374
- package/src/components/DialogTrigger.astro +0 -26
- package/src/components/FooterShell.astro +0 -43
- package/src/components/Grid.astro +0 -26
- package/src/components/GridCell.astro +0 -22
- package/src/components/HeaderShell.astro +0 -43
- package/src/components/Icon.astro +0 -30
- package/src/components/Image.astro +0 -18
- package/src/components/Link.astro +0 -71
- package/src/components/Meta.astro +0 -65
- package/src/components/Popover.astro +0 -187
- package/src/components/RichTextView.astro +0 -47
- package/src/components/Section.astro +0 -43
- package/src/components/SiteShell.astro +0 -152
- package/src/components/Video.astro +0 -51
- package/src/index.ts +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { PageMeta } from "@rxdrag/rxcms-models";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
content?: PageMeta;
|
|
6
|
-
title?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const { content, title: propTitle } = Astro.props;
|
|
10
|
-
|
|
11
|
-
// 从content中提取SEO相关属性
|
|
12
|
-
const {
|
|
13
|
-
// SeoMeta属性
|
|
14
|
-
seoTitle,
|
|
15
|
-
seoKeywords,
|
|
16
|
-
seoDescription,
|
|
17
|
-
seoAuthor,
|
|
18
|
-
publisher,
|
|
19
|
-
seoRobots,
|
|
20
|
-
// OgMeta属性
|
|
21
|
-
ogTitle,
|
|
22
|
-
ogDescription,
|
|
23
|
-
ogUrl,
|
|
24
|
-
ogSiteName,
|
|
25
|
-
ogType,
|
|
26
|
-
xCard,
|
|
27
|
-
xSite,
|
|
28
|
-
xUrl,
|
|
29
|
-
// 其他属性
|
|
30
|
-
ogImage,
|
|
31
|
-
} = content || {};
|
|
32
|
-
|
|
33
|
-
const title = propTitle || seoTitle || "YiZhanFei";
|
|
34
|
-
|
|
35
|
-
//暂时不输出canonicalUrl非必须
|
|
36
|
-
const canonicalURL = Astro.url.href;
|
|
37
|
-
const imageUrl = ogImage?.file?.url || "";
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
<title>{seoTitle || title}</title>
|
|
41
|
-
<meta name="description" content={seoDescription} />
|
|
42
|
-
<meta name="keywords" content={seoKeywords} />
|
|
43
|
-
<meta name="author" content={seoAuthor} />
|
|
44
|
-
<meta name="publisher" content={publisher} />
|
|
45
|
-
<meta name="robots" content={seoRobots || "index, follow"} />
|
|
46
|
-
<!-- <link rel="canonical" href={canonicalURL} /> -->
|
|
47
|
-
|
|
48
|
-
<!-- Open Graph / Facebook -->
|
|
49
|
-
<meta property="og:type" content={ogType || "website"} />
|
|
50
|
-
<meta property="og:url" content={ogUrl || canonicalURL} />
|
|
51
|
-
<meta property="og:title" content={ogTitle || title} />
|
|
52
|
-
<meta property="og:description" content={ogDescription || seoDescription} />
|
|
53
|
-
<meta property="og:image" content={imageUrl} />
|
|
54
|
-
{ogSiteName && <meta property="og:site_name" content={ogSiteName} />}
|
|
55
|
-
|
|
56
|
-
<!-- Twitter -->
|
|
57
|
-
<meta property="twitter:card" content={xCard || "summary_large_image"} />
|
|
58
|
-
<meta property="twitter:url" content={xUrl || ogUrl || canonicalURL} />
|
|
59
|
-
<meta property="twitter:title" content={ogTitle || title} />
|
|
60
|
-
<meta
|
|
61
|
-
property="twitter:description"
|
|
62
|
-
content={ogDescription || seoDescription}
|
|
63
|
-
/>
|
|
64
|
-
<meta property="twitter:image" content={imageUrl} />
|
|
65
|
-
{xSite && <meta property="twitter:site" content={xSite} />}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
interface ClassNames {
|
|
3
|
-
root?: string | string[];
|
|
4
|
-
trigger?: string | string[];
|
|
5
|
-
panel?: string | string[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
id: string;
|
|
10
|
-
classNames?: ClassNames;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { id, classNames } = Astro.props;
|
|
14
|
-
|
|
15
|
-
const normalize = (v?: string | string[]) => {
|
|
16
|
-
if (!v) return [];
|
|
17
|
-
return Array.isArray(v) ? v : [v];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const rootClassList = normalize(classNames?.root);
|
|
21
|
-
const triggerClassList = normalize(classNames?.trigger);
|
|
22
|
-
const panelClassList = normalize(classNames?.panel);
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
<div class:list={rootClassList} data-popover={id} data-open="0">
|
|
26
|
-
<style>
|
|
27
|
-
[data-popover-panel] {
|
|
28
|
-
height: 0;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
will-change: height;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
[data-popover-arrow] {
|
|
34
|
-
transition: transform 200ms ease;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[data-popover][data-open="1"] [data-popover-arrow] {
|
|
38
|
-
transform: rotate(180deg);
|
|
39
|
-
}
|
|
40
|
-
</style>
|
|
41
|
-
|
|
42
|
-
<button
|
|
43
|
-
type="button"
|
|
44
|
-
class:list={triggerClassList}
|
|
45
|
-
data-popover-trigger
|
|
46
|
-
aria-expanded="false"
|
|
47
|
-
aria-controls={`${id}-panel`}
|
|
48
|
-
>
|
|
49
|
-
<slot name="trigger" />
|
|
50
|
-
</button>
|
|
51
|
-
|
|
52
|
-
<div
|
|
53
|
-
id={`${id}-panel`}
|
|
54
|
-
data-popover-panel
|
|
55
|
-
class:list={panelClassList}
|
|
56
|
-
style="height:0px;overflow:hidden;"
|
|
57
|
-
>
|
|
58
|
-
<slot />
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<script is:inline>
|
|
63
|
-
(() => {
|
|
64
|
-
const globalKey = "__popover_doc_bound__";
|
|
65
|
-
const w = window;
|
|
66
|
-
if (!w[globalKey]) w[globalKey] = { docBound: false };
|
|
67
|
-
|
|
68
|
-
const init = () => {
|
|
69
|
-
const roots = document.querySelectorAll("[data-popover]");
|
|
70
|
-
roots.forEach((root) => {
|
|
71
|
-
if (!(root instanceof HTMLElement)) return;
|
|
72
|
-
if (root.dataset.bound === "1") return;
|
|
73
|
-
root.dataset.bound = "1";
|
|
74
|
-
|
|
75
|
-
const panel = root.querySelector("[data-popover-panel]");
|
|
76
|
-
const trigger = root.querySelector("[data-popover-trigger]");
|
|
77
|
-
if (!(panel instanceof HTMLElement) || !(trigger instanceof HTMLElement)) {
|
|
78
|
-
console.log("Popover: trigger/panel not found");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
let open = false;
|
|
83
|
-
let hoverTimer;
|
|
84
|
-
|
|
85
|
-
const setExpanded = (v) => {
|
|
86
|
-
trigger.setAttribute("aria-expanded", v ? "true" : "false");
|
|
87
|
-
root.setAttribute("data-open", v ? "1" : "0");
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const openPanel = () => {
|
|
91
|
-
if (open) return;
|
|
92
|
-
open = true;
|
|
93
|
-
setExpanded(true);
|
|
94
|
-
panel.style.transition = "height 600ms ease";
|
|
95
|
-
panel.style.height = "0px";
|
|
96
|
-
const h = panel.scrollHeight;
|
|
97
|
-
requestAnimationFrame(() => {
|
|
98
|
-
panel.style.height = h + "px";
|
|
99
|
-
});
|
|
100
|
-
const onEnd = () => {
|
|
101
|
-
if (open) {
|
|
102
|
-
panel.style.height = "auto";
|
|
103
|
-
}
|
|
104
|
-
panel.removeEventListener("transitionend", onEnd);
|
|
105
|
-
};
|
|
106
|
-
panel.addEventListener("transitionend", onEnd);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const closePanel = () => {
|
|
110
|
-
if (!open) return;
|
|
111
|
-
open = false;
|
|
112
|
-
setExpanded(false);
|
|
113
|
-
const h = panel.scrollHeight;
|
|
114
|
-
panel.style.transition = "height 250ms ease";
|
|
115
|
-
panel.style.height = h + "px";
|
|
116
|
-
requestAnimationFrame(() => {
|
|
117
|
-
panel.style.height = "0px";
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
root.__popoverClose = closePanel;
|
|
122
|
-
|
|
123
|
-
const toggle = () => {
|
|
124
|
-
if (open) closePanel();
|
|
125
|
-
else openPanel();
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
trigger.addEventListener("click", (e) => {
|
|
129
|
-
e.preventDefault();
|
|
130
|
-
toggle();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
root.addEventListener("mouseenter", () => {
|
|
134
|
-
clearTimeout(hoverTimer);
|
|
135
|
-
hoverTimer = setTimeout(() => openPanel(), 60);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
root.addEventListener("mouseleave", () => {
|
|
139
|
-
clearTimeout(hoverTimer);
|
|
140
|
-
hoverTimer = setTimeout(() => closePanel(), 120);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (!w[globalKey].docBound) {
|
|
145
|
-
w[globalKey].docBound = true;
|
|
146
|
-
|
|
147
|
-
const closeAll = () => {
|
|
148
|
-
const opened = document.querySelectorAll('[data-popover][data-open="1"]');
|
|
149
|
-
opened.forEach((r) => {
|
|
150
|
-
if (!(r instanceof HTMLElement)) return;
|
|
151
|
-
if (typeof r.__popoverClose === "function") {
|
|
152
|
-
r.__popoverClose();
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const p = r.querySelector("[data-popover-panel]");
|
|
156
|
-
const trig = r.querySelector("[data-popover-trigger]");
|
|
157
|
-
if (!(p instanceof HTMLElement) || !(trig instanceof HTMLElement)) return;
|
|
158
|
-
trig.setAttribute("aria-expanded", "false");
|
|
159
|
-
r.setAttribute("data-open", "0");
|
|
160
|
-
const h = p.scrollHeight;
|
|
161
|
-
p.style.transition = "height 250ms ease";
|
|
162
|
-
p.style.height = h + "px";
|
|
163
|
-
requestAnimationFrame(() => {
|
|
164
|
-
p.style.height = "0px";
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
document.addEventListener("click", (e) => {
|
|
170
|
-
const t = e.target;
|
|
171
|
-
if (!(t instanceof Element)) return;
|
|
172
|
-
if (t.closest('[data-popover][data-open="1"]')) return;
|
|
173
|
-
closeAll();
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
document.addEventListener("keydown", (e) => {
|
|
177
|
-
if (e.key !== "Escape") return;
|
|
178
|
-
closeAll();
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
init();
|
|
184
|
-
document.addEventListener("astro:page-load", init);
|
|
185
|
-
document.addEventListener("astro:after-swap", init);
|
|
186
|
-
})();
|
|
187
|
-
</script>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { mdxToSlate } from "@rxdrag/slate-preview";
|
|
3
|
-
import {
|
|
4
|
-
LeafPreviewView,
|
|
5
|
-
slatePreviews,
|
|
6
|
-
} from "@rxdrag/slate-preview";
|
|
7
|
-
import type { TSlateLeaf } from "@rxdrag/slate-preview";
|
|
8
|
-
import { ElementPreview } from "@rxdrag/slate-preview";
|
|
9
|
-
import { PRODUCT_KEY, ProductCard } from "@rxdrag/website-lib-core";
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
value?: string;
|
|
13
|
-
class?: string;
|
|
14
|
-
style?: string | Record<string, string | number>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const { value = "", class: className, style } = Astro.props;
|
|
18
|
-
const previews = { ...slatePreviews, [PRODUCT_KEY]: ProductCard };
|
|
19
|
-
const nodes = mdxToSlate(value);
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
<div class={className} style={style}>
|
|
23
|
-
{
|
|
24
|
-
nodes?.map((node, index) => {
|
|
25
|
-
// 递归处理节点的函数
|
|
26
|
-
const renderNode = (node: any) => {
|
|
27
|
-
// 纯文本节点
|
|
28
|
-
if (typeof node.text !== 'undefined') {
|
|
29
|
-
return <LeafPreviewView node={node as TSlateLeaf} />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 有子节点的元素
|
|
33
|
-
if (node.children && node.children.length > 0) {
|
|
34
|
-
return (
|
|
35
|
-
<ElementPreview node={node} previews={previews}>
|
|
36
|
-
{node.children.map((child: any) => renderNode(child))}
|
|
37
|
-
</ElementPreview>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return null;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return renderNode(node);
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
</div>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type {
|
|
3
|
-
AnimationConfig,
|
|
4
|
-
BackgroundConfig,
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
6
|
-
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
7
|
-
import Container from "./Container.astro";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 区块
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
class?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
containerClassName?: string;
|
|
17
|
-
backgrounds?: BackgroundConfig[];
|
|
18
|
-
//动效
|
|
19
|
-
animation?: AnimationConfig;
|
|
20
|
-
disableContainer?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
className,
|
|
25
|
-
containerClassName,
|
|
26
|
-
backgrounds,
|
|
27
|
-
disableContainer,
|
|
28
|
-
class: originalClass,
|
|
29
|
-
} = Astro.props;
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
<section class:list={["section-block", className, originalClass]}>
|
|
33
|
-
<BackgroundGroup backgrounds={backgrounds} />
|
|
34
|
-
{
|
|
35
|
-
disableContainer ? (
|
|
36
|
-
<slot />
|
|
37
|
-
) : (
|
|
38
|
-
<Container class:list={["w-full h-full", containerClassName]}>
|
|
39
|
-
<slot />
|
|
40
|
-
</Container>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
</section>
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import "aos/dist/aos.css";
|
|
3
|
-
import type { PageMeta } from "@rxdrag/rxcms-models";
|
|
4
|
-
import Meta from "./Meta.astro";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
lang?: string;
|
|
8
|
-
meta?: PageMeta;
|
|
9
|
-
title?: string;
|
|
10
|
-
aos?: {
|
|
11
|
-
easing?: string;
|
|
12
|
-
duration?: string;
|
|
13
|
-
delay?: string;
|
|
14
|
-
offset?: string;
|
|
15
|
-
once?: boolean;
|
|
16
|
-
disable?: boolean;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
lang = "en",
|
|
22
|
-
meta,
|
|
23
|
-
title,
|
|
24
|
-
aos = {
|
|
25
|
-
easing: "ease-out-cubic",
|
|
26
|
-
duration: "800",
|
|
27
|
-
delay: "0",
|
|
28
|
-
offset: "50",
|
|
29
|
-
once: true,
|
|
30
|
-
},
|
|
31
|
-
} = Astro.props;
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
<!doctype html>
|
|
35
|
-
<html lang={lang} class="aos-preload">
|
|
36
|
-
<head>
|
|
37
|
-
<meta charset="UTF-8" />
|
|
38
|
-
<meta
|
|
39
|
-
name="viewport"
|
|
40
|
-
content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=0.5, user-scalable=yes"
|
|
41
|
-
/>
|
|
42
|
-
|
|
43
|
-
<meta name="generator" content={Astro.generator} />
|
|
44
|
-
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
45
|
-
<slot name="head" />
|
|
46
|
-
<Meta title={title} content={meta} />
|
|
47
|
-
<style>
|
|
48
|
-
html.aos-preload [data-aos] {
|
|
49
|
-
opacity: 1 !important;
|
|
50
|
-
transform: none !important;
|
|
51
|
-
transition: none !important;
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
54
|
-
<script>
|
|
55
|
-
const w = window as any;
|
|
56
|
-
const state =
|
|
57
|
-
w.__aos_state__ ||
|
|
58
|
-
(w.__aos_state__ = { inited: false, loading: null, aos: null });
|
|
59
|
-
|
|
60
|
-
const el = document.documentElement;
|
|
61
|
-
const raf = () =>
|
|
62
|
-
new Promise((resolve) =>
|
|
63
|
-
requestAnimationFrame(() => resolve(undefined))
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const ensureAos = async () => {
|
|
67
|
-
if (state.aos) return state.aos;
|
|
68
|
-
if (!state.loading) {
|
|
69
|
-
state.loading = import("aos").then((m) => {
|
|
70
|
-
state.aos = m.default;
|
|
71
|
-
return state.aos;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return state.loading;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const bootOrRefresh = async () => {
|
|
78
|
-
if (
|
|
79
|
-
window.matchMedia &&
|
|
80
|
-
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
81
|
-
) {
|
|
82
|
-
el.classList.add("aos-ready");
|
|
83
|
-
el.classList.remove("aos-preload");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!document.querySelector("[data-aos]")) {
|
|
88
|
-
el.classList.add("aos-ready");
|
|
89
|
-
el.classList.remove("aos-preload");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
el.classList.add("aos-preload");
|
|
94
|
-
el.classList.remove("aos-ready");
|
|
95
|
-
|
|
96
|
-
const AOS = await ensureAos();
|
|
97
|
-
if (!state.inited) {
|
|
98
|
-
state.inited = true;
|
|
99
|
-
AOS.init({
|
|
100
|
-
duration: 800,
|
|
101
|
-
easing: "ease-out-cubic",
|
|
102
|
-
once: true,
|
|
103
|
-
offset: 50,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
await raf();
|
|
108
|
-
await raf();
|
|
109
|
-
AOS.refresh();
|
|
110
|
-
|
|
111
|
-
el.classList.add("aos-ready");
|
|
112
|
-
el.classList.remove("aos-preload");
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const boot = () => {
|
|
116
|
-
bootOrRefresh();
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
if (document.readyState === "loading") {
|
|
120
|
-
document.addEventListener("DOMContentLoaded", boot, { once: true });
|
|
121
|
-
} else {
|
|
122
|
-
boot();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
document.addEventListener("astro:page-load", boot);
|
|
126
|
-
document.addEventListener("astro:after-swap", boot);
|
|
127
|
-
</script>
|
|
128
|
-
</head>
|
|
129
|
-
<body
|
|
130
|
-
class="scroll-smooth"
|
|
131
|
-
data-aos-easing={aos.easing}
|
|
132
|
-
data-aos-duration={aos.duration}
|
|
133
|
-
data-aos-delay={aos.delay}
|
|
134
|
-
data-aos-offset={aos.offset}
|
|
135
|
-
data-aos-once={aos.once}
|
|
136
|
-
>
|
|
137
|
-
<slot />
|
|
138
|
-
</body>
|
|
139
|
-
</html>
|
|
140
|
-
|
|
141
|
-
<style>
|
|
142
|
-
html,
|
|
143
|
-
body {
|
|
144
|
-
margin: 0;
|
|
145
|
-
width: 100%;
|
|
146
|
-
height: 100%;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
html {
|
|
150
|
-
scroll-behavior: smooth;
|
|
151
|
-
}
|
|
152
|
-
</style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import {
|
|
3
|
-
Entify,
|
|
4
|
-
ReactVideoPlayer,
|
|
5
|
-
type Locals,
|
|
6
|
-
} from "@rxdrag/website-lib-core";
|
|
7
|
-
const { env, imageSizes } = Astro.locals as Locals;
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
videoRef?: string;
|
|
11
|
-
posterRef?: string;
|
|
12
|
-
endTitle?: string;
|
|
13
|
-
classNames?: {
|
|
14
|
-
container?: string;
|
|
15
|
-
video?: string;
|
|
16
|
-
playButton?: string;
|
|
17
|
-
playButtonOuter?: string;
|
|
18
|
-
playButtonInner?: string;
|
|
19
|
-
playIcon?: string;
|
|
20
|
-
overlay?: string;
|
|
21
|
-
overlayTitle?: string;
|
|
22
|
-
ctaButton?: string;
|
|
23
|
-
overlayReplayButton?: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
videoRef,
|
|
29
|
-
posterRef,
|
|
30
|
-
endTitle = "Contact Us Now",
|
|
31
|
-
classNames = {},
|
|
32
|
-
} = Astro.props;
|
|
33
|
-
|
|
34
|
-
const rx = Entify.getInstance(env, imageSizes);
|
|
35
|
-
|
|
36
|
-
// 获取媒体数据(增加 rx 为空时的保护)
|
|
37
|
-
const media = rx ? await rx.getMedia(videoRef) : undefined;
|
|
38
|
-
const poster = rx ? await rx.getMedia(posterRef) : undefined;
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
media && (
|
|
43
|
-
<ReactVideoPlayer
|
|
44
|
-
client:load
|
|
45
|
-
media={media}
|
|
46
|
-
endTitle={endTitle}
|
|
47
|
-
posterUrl={poster?.file?.original}
|
|
48
|
-
classNames={classNames}
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
51
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./components";
|