gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
make a youtube cone website
- User
make a youtube cone website
- Assistant
make a youtube cone website
Creating a simple YouTube clone website involves building a web page that mimics the basic interface of YouTube, such as displaying a list of videos with thumbnails, titles, and maybe some descriptions. For this example, I'll show you how to create a basic React app that renders a list of hardcoded "videos". This will help you understand how such a site can be structured.
If you haven't already, create a new React app (requires Node.js and npm/yarn installed):
npx create-react-app youtube-clone
cd youtube-clone
npm start
Below is a simple example of the components you can add.
src/App.js
import React, { useState } from "react";
import "./App.css";
const videosData = [
{
id: 1,
title: "Learn React in 30 Minutes",
channel: "Tech Guru",
views: "1.2M views",
date: "1 week ago",
thumbnail: "https://i.ytimg.com/vi/dGcsHMXbSOA/maxresdefault.jpg",
},
{
id: 2,
title: "JavaScript Tutorial for Beginners",
channel: "Code Academy",
views: "500K views",
date: "2 weeks ago",
thumbnail: "https://i.ytimg.com/vi/hdI2bqOjy3c/maxresdefault.jpg",
},
{
id: 3,
title: "CSS Grid Crash Course",
channel: "Design School",
views: "300K views",
date: "3 days ago",
thumbnail: "https://i.ytimg.com/vi/jV8B24rSN5o/maxresdefault.jpg",
},
];
function Header({ onSearch }) {
const [searchTerm, setSearchTerm] = useState("");
function handleSubmit(e) {
e.preventDefault();
onSearch(searchTerm);
}
return (
<header className="header">
<div className="logo">YouTube Clone</div>
<form className="search-bar" onSubmit={handleSubmit}>
<input
type="text"
placeholder="Search"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
<button type="submit">🔍</button>
</form>
</header>
);
}
function Sidebar() {
return (
<aside className="sidebar">
<nav>
<ul>
<li>🏠 Home</li>
<li>🔥 Trending</li>
<li>📺 Subscriptions</li>
<li>📚 Library</li>
</ul>
</nav>
</aside>
);
}
function VideoCard({ video }) {
return (
<div className="video-card">
<img className="thumbnail" src={video.thumbnail} alt={video.title} />
<div className="video-info">
<h4>{video.title}</h4>
<p>{video.channel}</p>
<p>
{video.views} • {video.date}
</p>
</div>
</div>
);
}
function App() {
const [videos, setVideos] = useState(videosData);
const [filteredVideos, setFilteredVideos] = useState(videosData);
function handleSearch(query) {
if (!query) {
setFilteredVideos(videos);
return;
}
const filtered = videos.filter((video) =>
video.title.toLowerCase().includes(query.toLowerCase())
);
setFilteredVideos(filtered);
}
return (
<div className="app">
<Header onSearch={handleSearch} />
<div className="body">
<Sidebar />
<main className="video-list">
{filteredVideos.length ? (
filteredVideos.map((video) => (
<VideoCard key={video.id} video={video} />
))
) : (
<p>No videos found</p>
)}
</main>
</div>
</div>
);
}
export default App;
src/App.css
/* Basic Reset */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
/* Header */
.header {
background-color: #ff0000;
color: white;
display: flex;
align-items: center;
padding: 0 20px;
height: 56px;
}
.logo {
font-weight: bold;
font-size: 1.5em;
}
.search-bar {
margin-left: auto;
display: flex;
}
.search-bar input {
padding: 6px 10px;
border: none;
outline: none;
width: 300px;
border-radius: 2px 0 0 2px;
font-size: 1em;
}
.search-bar button {
background-color: #cc0000;
border: none;
color: white;
cursor: pointer;
padding: 6px 12px;
font-size: 1em;
border-radius: 0 2px 2px 0;
}
/* Body Layout */
.body {
display: flex;
flex: 1;
background-color: #f9f9f9;
overflow: hidden;
}
/* Sidebar */
.sidebar {
width: 200px;
background-color: white;
border-right: 1px solid #ddd;
padding: 20px 0;
}
.sidebar nav ul {
list-style: none;
}
.sidebar nav ul li {
padding: 12px 24px;
cursor: pointer;
font-size: 1em;
}
.sidebar nav ul li:hover {
background-color: #f0f0f0;
}
/* Video list */
.video-list {
padding: 20px;
flex: 1;
overflow-y: auto;
display: grid;
grid-template-columns: repeat(auto-fill,minmax(280px,1fr));
gap: 20px;
}
/* Video Card */
.video-card {
background-color: white;
cursor: pointer;
border-radius: 4px;
overflow: hidden;
box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
transition: box-shadow 0.3s;
}
.video-card:hover {
box-shadow: 0 4px 8px rgb(0 0 0 / 0.15);
}
.thumbnail {
width: 100%;
height: 160px;
object-fit: cover;
}
.video-info {
padding: 12px 16px;
}
.video-info h4 {
margin-bottom: 6px;
font-size: 1em;
color: #000;
}
.video-info p {
color: #606060;
font-size: 0.875em;
margin-bottom: 4px;
}
npm start and open your browser at http://localhost:3000If you want to make it more realistic, you can:
If you want, I can also provide a vanilla JavaScript or a Python Flask example. Let me know!
Not yet included in a published release.