blob: 8d524996d0c7ae58253dbe99409fff8d6e0e9339 (
plain)
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
68
69
70
71
72
73
74
75
|
'use client';
import { useState, useEffect } from 'react';
import { cn } from '@/lib/utils';
// 배경 영상 목록
const BACKGROUND_VIDEOS = [
'/background-videos/1.yard.mp4',
'/background-videos/2.SN2635_LNGC_CARDIFF.mp4',
'/background-videos/3.SN2628_CONT_WAN HAI.mp4',
'/background-videos/4.SN2612_LNGC_KGL.mp4',
'/background-videos/5.SN2596_LNGC_JP MORGAN.mp4',
'/background-videos/6.2235_FLNG_ENI_CORAL.mp4',
'/background-videos/7.2126_FLNG_PETRONAS.mp4',
];
interface VideoBackgroundProps {
quote: string;
}
export function VideoBackground({ quote }: VideoBackgroundProps) {
const [currentVideoIndex, setCurrentVideoIndex] = useState(0);
// 컴포넌트 마운트 시 랜덤한 비디오 선택
useEffect(() => {
if (typeof window !== 'undefined') {
setCurrentVideoIndex(Math.floor(Math.random() * BACKGROUND_VIDEOS.length));
}
}, []);
// 비디오 종료 시 다음 비디오로 전환
const handleVideoEnd = () => {
setCurrentVideoIndex((prevIndex) => (prevIndex + 1) % BACKGROUND_VIDEOS.length);
};
return (
<div className="relative hidden h-full flex-col p-10 text-white dark:border-r md:flex overflow-hidden">
<div className="absolute inset-0">
<video
key={currentVideoIndex}
autoPlay
muted
onEnded={handleVideoEnd}
className="w-full h-full object-cover"
playsInline
>
<source src={BACKGROUND_VIDEOS[currentVideoIndex]} type="video/mp4" />
</video>
{/* 어두운 오버레이 */}
<div className="absolute inset-0 bg-black/30"></div>
</div>
<div className="relative z-10 mt-auto">
<blockquote className="space-y-2 backdrop-blur-sm bg-black/20 p-4 rounded-lg">
<p className="text-sm font-medium drop-shadow-lg">“{quote}”</p>
</blockquote>
</div>
{/* 비디오 인디케이터 */}
<div className="relative z-10 flex justify-center space-x-2 mb-4">
{BACKGROUND_VIDEOS.map((_, index) => (
<div
key={index}
className={cn(
"w-2 h-2 rounded-full transition-all duration-300",
index === currentVideoIndex
? "bg-white w-8"
: "bg-white/50 hover:bg-white/75 cursor-pointer"
)}
onClick={() => setCurrentVideoIndex(index)}
/>
))}
</div>
</div>
);
}
|