diff --git a/public/assets/videos/IMG_2919.mp4 b/public/assets/videos/IMG_2919.mp4 new file mode 100644 index 0000000..7e29144 Binary files /dev/null and b/public/assets/videos/IMG_2919.mp4 differ diff --git a/src/app/page.tsx b/src/app/page.tsx index 46dbb42..3dca996 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -7,6 +7,7 @@ import { Button } from '@/components/Button'; import Sponsors from '@/components/Home/SponsorCarousel'; import { FlexCarousel } from '@/components/Home/FlexCarousel'; import { EventCarousel } from '@/components/Home/EventCarousel'; +import VideoPlayer from '@/components/Home/VideoPlayer'; function Home() { const icons = Object.keys(homePageData.community); @@ -85,6 +86,7 @@ function Home() {
+
diff --git a/src/components/Home/VideoPlayer.tsx b/src/components/Home/VideoPlayer.tsx new file mode 100644 index 0000000..cc8fa0f --- /dev/null +++ b/src/components/Home/VideoPlayer.tsx @@ -0,0 +1,96 @@ +import React, { useRef, useState } from "react"; + +const VideoPlayer = () => { + const [isPlaying, setIsPlaying] = useState(false); + const [showModal, setShowModal] = useState(false); + const [fade, setFade] = useState(false); + const videoRef = useRef(null); + + const handleVideoClick = () => { + setShowModal(true); + setTimeout(() => setFade(true), 10); + }; + + const handleModalClose = () => { + setFade(false); + setTimeout(() => { + setShowModal(false); + setIsPlaying(false); + if (videoRef.current) { + videoRef.current.pause(); + videoRef.current.currentTime = 0; + } + }, 300); + }; + + const handlePlayPause = () => { + if (!videoRef.current) return; + if (isPlaying) { + videoRef.current.pause(); + } else { + videoRef.current.play(); + } + }; + + const handleBackdropClick = (e: React.MouseEvent) => { + if (e.target === e.currentTarget) { + handleModalClose(); + } + }; + + return ( + <> +
+
+ + {showModal && ( +
+
+ + + +
+
+ )} + + ); +}; + +export default VideoPlayer; \ No newline at end of file