Spaces:
No application file
No application file
Gh
Browse files
Gg
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import React, { useState } from 'react';
|
2 |
+
|
3 |
+
interface Video {
|
4 |
+
id: number;
|
5 |
+
scene: string;
|
6 |
+
imageUrl: string;
|
7 |
+
}
|
8 |
+
|
9 |
+
const videos: Video[] = [
|
10 |
+
{
|
11 |
+
id: 1,
|
12 |
+
scene: 'Beach Scene',
|
13 |
+
imageUrl: 'https://placehold.co/200x300/cccccc/ffffff?text=Scene+1'
|
14 |
+
},
|
15 |
+
{
|
16 |
+
id: 2,
|
17 |
+
scene: 'Bedroom Scene',
|
18 |
+
imageUrl: 'https://placehold.co/200x300/dddddd/333333?text=Scene+2'
|
19 |
+
|
20 |
+
},
|
21 |
+
{
|
22 |
+
id: 3,
|
23 |
+
scene: 'Pool Scene',
|
24 |
+
imageUrl: 'https://placehold.co/200x300/eeeeee/555555?text=Scene+3'
|
25 |
+
},
|
26 |
+
{
|
27 |
+
id: 4,
|
28 |
+
scene: 'Bathroom Scene',
|
29 |
+
imageUrl: 'https://placehold.co/200x300/fafafa/777777?text=Scene+4'
|
30 |
+
},
|
31 |
+
{
|
32 |
+
id: 5,
|
33 |
+
scene: 'Kitchen Scene',
|
34 |
+
imageUrl: 'https://placehold.co/200x300/f0f0f0/999999?text=Scene+5'
|
35 |
+
}
|
36 |
+
];
|
37 |
+
|
38 |
+
// Extracted VideoCard Component
|
39 |
+
const VideoCard: React.FC<{ video: Video; onClick: (video: Video) => void }> = ({ video, onClick }) => {
|
40 |
+
return (
|
41 |
+
<div
|
42 |
+
onClick={() => onClick(video)}
|
43 |
+
className="cursor-pointer rounded-xl overflow-hidden shadow-md transition-shadow duration-300 hover:shadow-xl bg-white"
|
44 |
+
>
|
45 |
+
<div className="aspect-w-2 aspect-h-3">
|
46 |
+
<img
|
47 |
+
src={video.imageUrl}
|
48 |
+
alt={video.scene}
|
49 |
+
className="w-full h-full object-cover"
|
50 |
+
/>
|
51 |
+
</div>
|
52 |
+
<div className="p-4">
|
53 |
+
<h2 className="text-lg font-semibold text-gray-700">{video.scene}</h2>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
);
|
57 |
+
};
|
58 |
+
|
59 |
+
const App: React.FC = () => {
|
60 |
+
const [selectedVideo, setSelectedVideo] = useState<Video | null>(null);
|
61 |
+
|
62 |
+
const handleVideoClick = (video: Video) => {
|
63 |
+
setSelectedVideo(video);
|
64 |
+
};
|
65 |
+
|
66 |
+
const handleCreateVideo = () => {
|
67 |
+
alert(`Video of scene ${selectedVideo?.scene} created!`); // Placehoder for actual video generation
|
68 |
+
};
|
69 |
+
|
70 |
+
return (
|
71 |
+
<div className="flex flex-col items-center p-4 bg-gray-100 min-h-screen">
|
72 |
+
<h1 className="text-2xl font-bold mb-8 text-gray-800">10 Second Video Creator</h1>
|
73 |
+
<div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4 mb-8">
|
74 |
+
{videos.map((video) => (
|
75 |
+
<VideoCard key={video.id} video={video} onClick={handleVideoClick} />
|
76 |
+
))}
|
77 |
+
</div>
|
78 |
+
{selectedVideo && (
|
79 |
+
<div className="bg-white p-6 rounded-xl shadow-md w-full max-w-md">
|
80 |
+
<h2 className="text-xl font-semibold mb-4 text-gray-800">Preview</h2>
|
81 |
+
<div className="aspect-w-16 aspect-h-9 overflow-hidden rounded-md">
|
82 |
+
<img src={selectedVideo.imageUrl} alt={selectedVideo.scene} className="object-cover" />
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<p className="mt-4 text-gray-700">Scene: {selectedVideo.scene}</p>
|
86 |
+
<p className="text-gray-600 text-sm mt-2">Duration: 10 seconds</p>
|
87 |
+
<button
|
88 |
+
onClick={handleCreateVideo}
|
89 |
+
className="mt-6 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
90 |
+
Create Video
|
91 |
+
</button>
|
92 |
+
</div>
|
93 |
+
)}
|
94 |
+
</div>
|
95 |
+
);
|
96 |
+
};
|
97 |
+
|
98 |
+
export default App;
|