Skip to content
The Chat Archive
amazon.nova-pro-v1:0 LMArena Human Preference 140K

--- 🎯 Prompt for Gemini (Frontend-Only YouTube Clone) 🧩 Project Overview: Build a…

  1. User

    🎯 Prompt for Gemini (Frontend-Only YouTube Clone)

    🧩 Project Overview:

    Build a YouTube Clone UI using React.js + Tailwind CSS, with fully embedded playable videos. The app must not use any backend and should use static video data (JSON/JS array). The goal is to replicate the visual layout and interactivity of YouTube, based on the attached screenshots.


    πŸ”§ Technologies to Use:

    • React.js (with React Router DOM)
    • Tailwind CSS
    • HTML5 Video Element
    • Dummy video data (JS array of objects)
    • No backend or API calls

    πŸ“„ App Structure

    src/
    β”œβ”€β”€ App.jsx
    β”œβ”€β”€ main.jsx
    β”œβ”€β”€ data/
    β”‚   └── videos.js
    β”œβ”€β”€ components/
    β”‚   β”œβ”€β”€ Navbar.jsx
    β”‚   β”œβ”€β”€ Sidebar.jsx
    β”‚   β”œβ”€β”€ VideoCard.jsx
    β”‚   β”œβ”€β”€ VideoGrid.jsx
    β”‚   β”œβ”€β”€ VideoPlayer.jsx
    β”‚   └── RelatedVideos.jsx
    β”œβ”€β”€ pages/
    β”‚   β”œβ”€β”€ Home.jsx
    β”‚   └── Watch.jsx
    

    πŸ’‘ Key Features to Implement


    1. Navbar (Top Bar)

    • Show logo "YouTube Clone"
    • Search bar (non-functional)
    • "Create", "Bell" icons (dummy)
    • Avatar on the right

    2. Sidebar (Left Menu)

    • Show vertical menu with:

      • Home
      • Shorts
      • Subscriptions
      • History, Playlists, etc.
    • Responsive (collapses on mobile)


    3. Home Page (****/****)

    • Display video cards in 3-column grid
    • Use dummy video array with fields like:
    {
      id: "1",
      title: "Learn React in 10 Minutes",
      channel: "DevTutor",
      views: "200K views",
      date: "3 days ago",
      thumbnail: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
      videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4"
    }
    
    • Each card must show:

      • Thumbnail (image)
      • Title
      • Channel name
      • Views + Time
    • Clicking a card routes to /watch/:id


    4. Watch Page (****/watch/:id****)

    • Display HTML5 <video> element with controls
    • Show title, channel, likes (dummy), date
    • "Subscribe" button (non-functional)
    • Description below video
    • Autoplay selected video based on ID from dummy data
    • Sidebar on the right with Related Videos (map from same dummy data, except current one)

    5. Video Playback

    • Use embedded video element:
    <video controls className="w-full h-auto rounded-lg">
      <source src={video.videoUrl} type="video/mp4" />
      Your browser does not support the video tag.
    </video>
    
    • Supports local file links or public MP4 links (like W3Schools videos)

    🧠 Bonus Features (Optional for Gemini to Try)

    • Video player layout matches YouTube (left video, right suggestions)
    • Scroll behavior and sticky sidebar
    • Lazy load thumbnails
    • Responsive mobile-first layout
    • Tailwind dark mode support

    πŸ§ͺ Testing Goals for Gemini

    • Can Gemini build a Home + Watch layout UI like YouTube from images
    • Can Gemini map a video ID to actual embedded playback
    • Can Gemini render a list of related videos excluding the current one
    • Can Gemini structure clean reusable components

    βœ… Final Output Expectation

    A complete React + Tailwind project with:

    • Working routing
    • Embedded playable videos
    • Static data-driven pages
    • No backend, no API
    • Fully responsive YouTube-like layout
    • Mirrors the layout from the provided screenshots

  2. Assistant

    Here's a complete implementation of the YouTube Clone UI using React.js and Tailwind CSS, following the provided structure and requirements.

    Project Structure

    src/
    β”œβ”€β”€ App.jsx
    β”œβ”€β”€ main.jsx
    β”œβ”€β”€ data/
    β”‚   └── videos.js
    β”œβ”€β”€ components/
    β”‚   β”œβ”€β”€ Navbar.jsx
    β”‚   β”œβ”€β”€ Sidebar.jsx
    β”‚   β”œβ”€β”€ VideoCard.jsx
    β”‚   β”œβ”€β”€ VideoGrid.jsx
    β”‚   β”œβ”€β”€ VideoPlayer.jsx
    β”‚   └── RelatedVideos.jsx
    β”œβ”€β”€ pages/
    β”‚   β”œβ”€β”€ Home.jsx
    β”‚   └── Watch.jsx
    

    Implementation

    src/data/videos.js

    export const videos = [
      {
        id: "1",
        title: "Learn React in 10 Minutes",
        channel: "DevTutor",
        views: "200K views",
        date: "3 days ago",
        thumbnail: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
        description: "A quick tutorial on React.js basics."
      },
      {
        id: "2",
        title: "Introduction to Tailwind CSS",
        channel: "StyleMaster",
        views: "150K views",
        date: "5 days ago",
        thumbnail: "https://i.ytimg.com/vi/XGSy3_Czz8k/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/movie.mp4",
        description: "Learn how to use Tailwind CSS for styling."
      },
      // Add more videos as needed
    ];
    

    src/components/Navbar.jsx

    import React from 'react';
    import { Link } from 'react-router-dom';
    
    const Navbar = () => {
      return (
        <nav className="bg-gray-800 p-4 flex justify-between items-center">
          <div className="text-white font-bold text-xl">YouTube Clone</div>
          <div className="flex items-center space-x-4">
            <input 
              type="text" 
              placeholder="Search" 
              className="bg-gray-700 text-white p-2 rounded"
            />
            <div className="text-white">Create</div>
            <div className="text-white">Bell</div>
            <img 
              src="https://via.placeholder.com/30" 
              alt="Avatar" 
              className="w-8 h-8 rounded-full"
            />
          </div>
        </nav>
      );
    };
    
    export default Navbar;
    

    src/components/Sidebar.jsx

    import React from 'react';
    import { Link } from 'react-router-dom';
    
    const Sidebar = () => {
      return (
        <div className="bg-gray-800 text-white w-64 p-4">
          <ul>
            <li><Link to="/" className="block p-2">Home</Link></li>
            <li><Link to="/" className="block p-2">Shorts</Link></li>
            <li><Link to="/" className="block p-2">Subscriptions</Link></li>
            <li><Link to="/" className="block p-2">History</Link></li>
            <li><Link to="/" className="block p-2">Playlists</Link></li>
          </ul>
        </div>
      );
    };
    
    export default Sidebar;
    

    src/components/VideoCard.jsx

    import React from 'react';
    import { Link } from 'react-router-dom';
    
    const VideoCard = ({ video }) => {
      return (
        <Link to={`/watch/${video.id}`} className="block p-4 bg-gray-800 rounded-lg">
          <img src={video.thumbnail} alt={video.title} className="w-full h-auto rounded-lg mb-2"/>
          <h3 className="text-white font-bold">{video.title}</h3>
          <p className="text-gray-400 text-sm">{video.channel}</p>
          <p className="text-gray-400 text-xs">{video.views} β€’ {video.date}</p>
        </Link>
      );
    };
    
    export default VideoCard;
    

    src/components/VideoGrid.jsx

    import React from 'react';
    import VideoCard from './VideoCard';
    import { videos } from '../data/videos';
    
    const VideoGrid = () => {
      return (
        <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
          {videos.map(video => (
            <VideoCard key={video.id} video={video} />
          ))}
        </div>
      );
    };
    
    export default VideoGrid;
    

    src/components/VideoPlayer.jsx

    import React from 'react';
    
    const VideoPlayer = ({ videoUrl }) => {
      return (
        <video controls className="w-full h-auto rounded-lg">
          <source src={videoUrl} type="video/mp4" />
          Your browser does not support the video tag.
        </video>
      );
    };
    
    export default VideoPlayer;
    

    src/components/RelatedVideos.jsx

    import React from 'react';
    import VideoCard from './VideoCard';
    import { videos } from '../data/videos';
    
    const RelatedVideos = ({ currentVideoId }) => {
      const relatedVideos = videos.filter(video => video.id !== currentVideoId);
      return (
        <div className="space-y-4">
          {relatedVideos.map(video => (
            <VideoCard key={video.id} video={video} />
          ))}
        </div>
      );
    };
    
    export default RelatedVideos;
    

    src/pages/Home.jsx

    import React from 'react';
    import VideoGrid from '../components/VideoGrid';
    import Sidebar from '../components/Sidebar';
    import Navbar from '../components/Navbar';
    
    const Home = () => {
      return (
        <div className="flex">
          <Sidebar />
          <div className="flex-1">
            <Navbar />
            <VideoGrid />
          </div>
        </div>
      );
    };
    
    export default Home;
    

    src/pages/Watch.jsx

    import React from 'react';
    import { useParams } from 'react-router-dom';
    import VideoPlayer from '../components/VideoPlayer';
    import RelatedVideos from '../components/RelatedVideos';
    import { videos } from '../data/videos';
    
    const Watch = () => {
      const { id } = useParams();
      const video = videos.find(video => video.id === id);
      
      if (!video) {
        return <div>Video not found</div>;
      }
    
      return (
        <div className="flex">
          <div className="flex-1 p-4">
            <VideoPlayer videoUrl={video.videoUrl} />
            <h2 className="text-white text-2xl font-bold mt-4">{video.title}</h2>
            <p className="text-gray-400">{video.channel}</p>
            <p className="text-gray-400">{video.views} β€’ {video.date}</p>
            <p className="text-white mt-4">{video.description}</p>
          </div>
          <div className="w-64">
            <RelatedVideos currentVideoId={id} />
          </div>
        </div>
      );
    };
    
    export default Watch;
    

    src/App.jsx

    import React from 'react';
    import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
    import Home from './pages/Home';
    import Watch from './pages/Watch';
    
    const App = () => {
      return (
        <Router>
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="/watch/:id" element={<Watch />} />
          </Routes>
        </Router>
      );
    };
    
    export default App;
    

    src/main.jsx

    import React from 'react';
    import ReactDOM from 'react-dom/client';
    import App from './App';
    import './index.css';
    
    const root = ReactDOM.createRoot(document.getElementById('root'));
    root.render(
      <React.StrictMode>
        <App />
      </React.StrictMode>
    );
    

    src/index.css

    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    
    body {
      @apply bg-gray-900 text-white;
    }
    

    Explanation

    1. Navbar: Displays the logo, search bar, and dummy icons.
    2. Sidebar: Displays a vertical menu with links.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.