Skip to content
The Chat Archive
claude-3-7-sonnet-20250219Β· Anthropic 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

    I'll create a complete YouTube clone UI using React.js and Tailwind CSS with embedded playable videos. This implementation will follow the structure you provided and include all the key features.

    Complete Implementation

    1. 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: "This quick tutorial covers all the React basics you need to get started with building your own applications. Perfect for beginners who want to jump right in!"
      },
      {
        id: "2",
        title: "Tailwind CSS Crash Course",
        channel: "CSS Ninja",
        views: "150K views",
        date: "1 week ago",
        thumbnail: "https://i.ytimg.com/vi/UBOj6rqRUME/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/movie.mp4",
        description: "Learn how to use Tailwind CSS to rapidly build modern websites without ever leaving your HTML. This utility-first CSS framework is changing how developers style their applications."
      },
      {
        id: "3",
        title: "JavaScript ES6 Features You Must Know",
        channel: "JS Master",
        views: "300K views",
        date: "2 weeks ago",
        thumbnail: "https://i.ytimg.com/vi/NCwa_xi0Uuc/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
        description: "ES6 introduced many features that make JavaScript more powerful and expressive. This video covers arrow functions, destructuring, template literals, and more!"
      },
      {
        id: "4",
        title: "Build a Full Stack App with MERN",
        channel: "WebDev Pro",
        views: "180K views",
        date: "3 weeks ago",
        thumbnail: "https://i.ytimg.com/vi/7CqJlxBYj-M/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/movie.mp4",
        description: "Learn how to build a complete application using MongoDB, Express, React, and Node.js. This comprehensive tutorial takes you from setup to deployment."
      },
      {
        id: "5",
        title: "CSS Grid Layout Tutorial",
        channel: "CSS Ninja",
        views: "120K views",
        date: "1 month ago",
        thumbnail: "https://i.ytimg.com/vi/jV8B24rSN5o/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
        description: "CSS Grid makes complex layouts simple. This tutorial covers everything you need to know about creating responsive grid layouts for modern websites."
      },
      {
        id: "6",
        title: "TypeScript for React Developers",
        channel: "DevTutor",
        views: "90K views",
        date: "1 month ago",
        thumbnail: "https://i.ytimg.com/vi/Z5iWr6Srsj8/hqdefault.jpg",
        videoUrl: "https://www.w3schools.com/html/movie.mp4",
        description: "Take your React applications to the next level with TypeScript. Learn how to add static typing to your components and reduce bugs in your code."
      }
    ];
    

    2. src/components/Navbar.jsx

    import { Link } from 'react-router-dom';
    
    const Navbar = () => {
      return (
        <nav className="bg-gray-900 text-white p-4 flex items-center justify-between fixed top-0 w-full z-10">
          {/* Logo */}
          <div className="flex items-center">
            <Link to="/" className="text-xl font-bold">YouTube Clone</Link>
          </div>
          
          {/* Search Bar */}
          <div className="hidden md:flex flex-grow mx-8 max-w-2xl">
            <input 
              type="text" 
              placeholder="Search" 
              className="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-l-full focus:outline-none"
            />
            <button className="bg-gray-700 px-4 rounded-r-full border border-l-0 border-gray-700">
              <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
              </svg>
            </button>
          </div>
          
          {/* Icons */}
          <div className="flex items-center space-x-4">
            <button className="p-2">
              <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" />
              </svg>
            </button>
            <button className="p-2">
              <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
              </svg>
            </button>
            <img 
              src="https://i.pravatar.cc/150?img=12" 
              alt="User Avatar" 
              className="w-8 h-8 rounded-full"
            />
          </div>
        </nav>
      );
    };
    
    export default Navbar;
    

    3. src/components/Sidebar.jsx

    import { Link } from 'react-router-dom';
    
    const Sidebar = () => {
      return (
        <div className="hidden md:block fixed left-0 top-16 h-full w-64 bg-gray-900 overflow-y-auto">
          <div className="p-4">
            <ul className="space-y-2">
              <li>
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
                  </svg>
                  Home
                </Link>
              </li>
              <li>
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 10V3L4 14h7v7l9-11h-7z" />
                  </svg>
                  Shorts
                </Link>
              </li>
              <li>
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
                  </svg>
                  Subscriptions
                </Link>
              </li>
              <li className="pt-4 border-t border-gray-700 mt-4">
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
                  </svg>
                  History
                </Link>
              </li>
              <li>
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z" />
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                  </svg>
                  Your videos
                </Link>
              </li>
              <li>
                <Link to="/" className="flex items-center p-2 text-white hover:bg-gray-800 rounded-lg">
                  <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z" />
                  </svg>
                  Playlists
                </Link>
              </li>
            </ul>
          </div>
        </div>
      );
    };
    
    export default Sidebar;
    

    4. src/components/VideoCard.jsx

    import { Link } from 'react-router-dom';
    
    const VideoCard = ({ video }) => {
      return (
        <Link to={`/watch/${video.id}`} className="block">
          <div className="bg-gray-800 rounded-lg overflow-hidden hover:bg-gray-700 transition duration-300">
            <img 
              src={video.thumbnail} 
              alt={video.title} 
              className="w-full h-48 object-cover"
              loading="lazy" // Bonus: Lazy loading thumbnails
            />
            <div className="p-3">
              <h3 className="text-white font-medium line-clamp-2">{video.title}</h3>
              <p className="text-gray-400 text-sm mt-1">{video.channel}</p>
              <p className="text-gray-400 text-xs mt-1">
                {video.views} β€’ {video.date}
              </p>
            </div>
          </div>
        </Link>
      );
    };
    
    export default VideoCard;
    

    5. src/components/VideoGrid.jsx

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

    6. src/components/VideoPlayer.jsx

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

    7. src/components/RelatedVideos.jsx

    import { Link } from 'react-router-dom';
    import { videos } from '../data/videos';
    
    const RelatedVideos = ({ currentVideoId }) => {
      // Filter out the current video
      const relatedVideos = videos.filter(video => video.id !== currentVideoId);
      
      return (
        <div className="space-y-4">
          {relatedVideos.map(video => (
            <Link to={`/watch/${video.id}`} key={video.id} className="flex gap-2 hover:bg-gray-800 p-2 rounded-lg">
              <img 
                src={video.thumbnail} 
                alt={video.title} 
                className="w-40 h-24 object-cover rounded-lg"
                loading="lazy"
              />
              <div className="flex-1">
                <h
    

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