forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaximizable-video.tsx
More file actions
67 lines (62 loc) · 1.97 KB
/
Copy pathmaximizable-video.tsx
File metadata and controls
67 lines (62 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"use client";
import { useState } from "react";
import { Maximize2 } from "lucide-react";
interface MaximizableVideoProps {
src: string;
className?: string;
}
export function MaximizableVideo({ src, className = "" }: MaximizableVideoProps) {
const [isModalOpen, setIsModalOpen] = useState(false);
return (
<>
<div className={`relative group ${className}`}>
<div className="absolute -inset-1 rounded-3xl"></div>
<video
src={src}
autoPlay
loop
muted
playsInline
className="relative rounded-2xl w-full"
/>
<button
onClick={() => setIsModalOpen(true)}
className="absolute top-4 right-4 p-2 bg-black/50 hover:bg-black/70 rounded-lg transition-all duration-200 opacity-0 group-hover:opacity-100"
aria-label="Maximize video"
>
<Maximize2 className="w-4 h-4 text-white" />
</button>
</div>
{isModalOpen && (
<div
className="fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4"
onClick={(e) => {
if (e.target === e.currentTarget) {
setIsModalOpen(false);
}
}}
>
<div className="relative max-w-4xl w-full">
<button
onClick={() => setIsModalOpen(false)}
className="absolute -top-12 right-0 p-2 text-white hover:text-gray-300 transition-colors"
aria-label="Close video"
>
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<video
src={src}
autoPlay
loop
muted
playsInline
className="rounded-2xl w-full"
/>
</div>
</div>
)}
</>
);
}