irongit

video section goes to full screen

huncholanehuncholaneauthored
parent cf3396dcommit a462a0586dc750f0c1bfc4413749d52cddcdb188Browse files

2 files changed, +19 -3

+1-1twench_landing_page/components/VideoSection/VideoSection.css
@@ -3,7 +3,7 @@
33 }
44
55 .VideoSection .Preview {
6- @apply w-[290px] h-[175px] bg-black border-4 border-primary rounded-md left-1/2 absolute transform -rotate-12 -translate-y-1/2 -translate-x-1/2;
6+ @apply w-[290px] h-[166px] bg-black border-4 border-primary rounded-md left-1/2 absolute transform -rotate-12 -translate-y-1/2 -translate-x-1/2 cursor-pointer;
77 }
88
99 .VideoSection .Preview button {
+18-2twench_landing_page/components/VideoSection/VideoSection.tsx
@@ -1,11 +1,27 @@
1-import React from "react";
1+"use client";
2+import React, { useRef } from "react";
23 import "./VideoSection.css";
34
45 const VideoSection: React.FC = () => {
6+ const videoRef = useRef<HTMLVideoElement>(null);
7+
8+ const handleVideoClick = () => {
9+ if (videoRef.current) {
10+ if (videoRef.current.requestFullscreen) {
11+ videoRef.current.requestFullscreen();
12+ }
13+ }
14+ };
15+
516 return (
617 <div className="VideoSection">
718 <div className="Preview">
8- <button></button>
19+ <video
20+ ref={videoRef}
21+ src="/videos/v2.mp4"
22+ controls
23+ onClick={handleVideoClick}
24+ ></video>
925 </div>
1026 </div>
1127 );