From c8d4bbde9ef628c43326862b5a7025fe2bcbbec3 Mon Sep 17 00:00:00 2001 From: dianed-square <73617011+dianed-square@users.noreply.github.com> Date: Wed, 17 Sep 2025 07:49:26 -0700 Subject: [PATCH] docs: recipe video carousel (#4660) --- .../docs/guides/interactive-chat/index.md | 5 + .../guides/recipes/{index.md => index.mdx} | 27 ++++- documentation/src/components/VideoCarousel.js | 99 +++++++++++++++++++ 3 files changed, 130 insertions(+), 1 deletion(-) rename documentation/docs/guides/recipes/{index.md => index.mdx} (81%) create mode 100644 documentation/src/components/VideoCarousel.js diff --git a/documentation/docs/guides/interactive-chat/index.md b/documentation/docs/guides/interactive-chat/index.md index 7b3902c0b6..97cd81656b 100644 --- a/documentation/docs/guides/interactive-chat/index.md +++ b/documentation/docs/guides/interactive-chat/index.md @@ -57,5 +57,10 @@ import styles from '@site/src/components/Card/styles.module.css'; description="Automatically render visual representations of data as you interact with it, powered by MCP-UI" link="/blog/2025/08/27/autovisualiser-with-mcp-ui" /> + \ No newline at end of file diff --git a/documentation/docs/guides/recipes/index.md b/documentation/docs/guides/recipes/index.mdx similarity index 81% rename from documentation/docs/guides/recipes/index.md rename to documentation/docs/guides/recipes/index.mdx index 3ca797e44f..3e77aecff7 100644 --- a/documentation/docs/guides/recipes/index.md +++ b/documentation/docs/guides/recipes/index.mdx @@ -6,6 +6,7 @@ description: Reusable and shareable AI workflows import Card from '@site/src/components/Card'; import styles from '@site/src/components/Card/styles.module.css'; +import VideoCarousel from '@site/src/components/VideoCarousel';

Recipes

@@ -22,7 +23,7 @@ import styles from '@site/src/components/Card/styles.module.css'; allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen > - +

📚 Documentation & Guides

@@ -91,3 +92,27 @@ import styles from '@site/src/components/Card/styles.module.css'; />
+ +
+

🎥 More Videos

+ + +
\ No newline at end of file diff --git a/documentation/src/components/VideoCarousel.js b/documentation/src/components/VideoCarousel.js new file mode 100644 index 0000000000..e671bd1cdb --- /dev/null +++ b/documentation/src/components/VideoCarousel.js @@ -0,0 +1,99 @@ +// src/components/VideoCarousel.js +import React from 'react'; +import { Swiper, SwiperSlide } from 'swiper/react'; +import { Navigation, Pagination, FreeMode } from 'swiper/modules'; +import 'swiper/css'; +import 'swiper/css/navigation'; +import 'swiper/css/pagination'; +import 'swiper/css/free-mode'; + +const VideoCarousel = ({ videos, id, width = '100%', names = [] }) => { + const [activeIndex, setActiveIndex] = React.useState(0); + + const getCurrentVideoName = () => { + if (Array.isArray(names) && names.length > activeIndex && names[activeIndex]) { + return names[activeIndex]; + } + return ''; + }; + + return ( +
+ {getCurrentVideoName() && ( +

{getCurrentVideoName()}

+ )} + setActiveIndex(swiper.activeIndex)} + > + {videos.map((video, index) => ( + +
+
+ {video.type === 'iframe' ? ( + + ) : ( +
+ {(video.description || video.duration) && ( +
+ {video.description && {video.description}} + {video.duration && ( + + • + {video.duration} + + )} +
+ )} +
+
+ ))} +
+
+ ); +}; + +export default VideoCarousel;