Update index.html
Browse files- index.html +71 -12
index.html
CHANGED
@@ -1,12 +1,71 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import React, { useState } from 'react';
|
2 |
+
import { Search } from 'lucide-react';
|
3 |
+
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
4 |
+
|
5 |
+
const YouTubeSearch = () => {
|
6 |
+
const [searchQuery, setSearchQuery] = useState('');
|
7 |
+
const [selectedVideo, setSelectedVideo] = useState(null);
|
8 |
+
|
9 |
+
const handleSearch = (e) => {
|
10 |
+
e.preventDefault();
|
11 |
+
if (searchQuery.trim()) {
|
12 |
+
// Формируем URL для поиска на YouTube
|
13 |
+
const searchUrl = `https://www.youtube.com/results?search_query=${encodeURIComponent(searchQuery)}`;
|
14 |
+
window.open(searchUrl, '_blank');
|
15 |
+
}
|
16 |
+
};
|
17 |
+
|
18 |
+
return (
|
19 |
+
<div className="max-w-4xl mx-auto p-4">
|
20 |
+
<Card className="mb-6">
|
21 |
+
<CardHeader>
|
22 |
+
<CardTitle className="text-2xl font-bold text-center">YouTube Поиск</CardTitle>
|
23 |
+
</CardHeader>
|
24 |
+
<CardContent>
|
25 |
+
<form onSubmit={handleSearch} className="flex gap-2">
|
26 |
+
<input
|
27 |
+
type="text"
|
28 |
+
value={searchQuery}
|
29 |
+
onChange={(e) => setSearchQuery(e.target.value)}
|
30 |
+
placeholder="Что вы хотите найти?"
|
31 |
+
className="flex-1 px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
32 |
+
/>
|
33 |
+
<button
|
34 |
+
type="submit"
|
35 |
+
className="px-6 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 flex items-center gap-2"
|
36 |
+
>
|
37 |
+
<Search size={20} />
|
38 |
+
Поиск
|
39 |
+
</button>
|
40 |
+
</form>
|
41 |
+
</CardContent>
|
42 |
+
</Card>
|
43 |
+
|
44 |
+
{selectedVideo && (
|
45 |
+
<Card className="mt-6">
|
46 |
+
<CardContent className="p-4">
|
47 |
+
<div className="relative w-full pt-[56.25%]">
|
48 |
+
<iframe
|
49 |
+
className="absolute top-0 left-0 w-full h-full"
|
50 |
+
src={`https://www.youtube.com/embed/${selectedVideo}`}
|
51 |
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
52 |
+
allowFullScreen
|
53 |
+
></iframe>
|
54 |
+
</div>
|
55 |
+
</CardContent>
|
56 |
+
</Card>
|
57 |
+
)}
|
58 |
+
|
59 |
+
<div className="mt-4 text-sm text-gray-600">
|
60 |
+
<p>Советы по поиску:</p>
|
61 |
+
<ul className="list-disc pl-5 mt-2">
|
62 |
+
<li>Используйте ключевые слова для более точного поиска</li>
|
63 |
+
<li>Добавляйте год для поиска видео за определенный период</li>
|
64 |
+
<li>Используйте кавычки для поиска точной фразы</li>
|
65 |
+
</ul>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
);
|
69 |
+
};
|
70 |
+
|
71 |
+
export default YouTubeSearch;
|