astro-tractstack 2.0.0-rc.53 → 2.0.0-rc.54
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
CHANGED
|
@@ -6,9 +6,15 @@ interface BunnyVideoProps {
|
|
|
6
6
|
|
|
7
7
|
const BUNNY_EMBED_BASE_URL = 'https://iframe.mediadelivery.net/embed/';
|
|
8
8
|
|
|
9
|
+
const isValidBunnyVideoId = (id: string): boolean => {
|
|
10
|
+
if (!id) return false;
|
|
11
|
+
const videoIdRegex = /^\d+\/[a-f0-9\-]{36}$/;
|
|
12
|
+
return videoIdRegex.test(id);
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
const BunnyVideo = ({ videoId, title, className = '' }: BunnyVideoProps) => {
|
|
10
|
-
// If
|
|
11
|
-
if (!videoId) {
|
|
16
|
+
// If the videoId is missing or has an invalid format, render the placeholder.
|
|
17
|
+
if (!isValidBunnyVideoId(videoId)) {
|
|
12
18
|
return (
|
|
13
19
|
<div
|
|
14
20
|
className={`flex aspect-video w-full items-center justify-center bg-gray-100 ${className}`}
|