Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219· AnthropicHugging Face LMArena Human Preference 140K

generate the code script a comprehensive interface of a modern ecommerce site

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Amazon Novaamazon.nova-pro-v1:0’s answer.
  1. User

    generate the code script a comprehensive interface of a modern ecommerce site

  2. Claude Assistant

    Here's a modern e-commerce interface using React and styled-components:

    import React, { useState, useEffect } from 'react';
    import styled from 'styled-components';
    
    // Styled Components
    const Container = styled.div`
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 20px;
    `;
    
    const Header = styled.header`
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 0;
      border-bottom: 1px solid #eaeaea;
    `;
    
    const Logo = styled.h1`
      font-size: 24px;
      font-weight: 700;
      color: #333;
    `;
    
    const Nav = styled.nav`
      display: flex;
      gap: 20px;
    `;
    
    const NavLink = styled.a`
      text-decoration: none;
      color: #333;
      font-weight: 500;
      transition: color 0.2s;
      
      &:hover {
        color: #0070f3;
      }
    `;
    
    const SearchBar = styled.div`
      display: flex;
      align-items: center;
      background: #f5f5f5;
      border-radius: 24px;
      padding: 8px 16px;
      margin: 20px 0;
    `;
    
    const SearchInput = styled.input`
      border: none;
      background: transparent;
      width: 100%;
      padding: 8px;
      outline: none;
      font-size: 16px;
    `;
    
    const ProductGrid = styled.div`
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 30px;
      margin: 40px 0;
    `;
    
    const ProductCard = styled.div`
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      transition: transform 0.3s, box-shadow 0.3s;
      
      &:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
      }
    `;
    
    const ProductImage = styled.img`
      width: 100%;
      height: 200px;
      object-fit: cover;
    `;
    
    const ProductInfo = styled.div`
      padding: 16px;
    `;
    
    const ProductName = styled.h3`
      font-size: 18px;
      margin-bottom: 8px;
    `;
    
    const ProductPrice = styled.p`
      font-size: 20px;
      font-weight: 600;
      color: #0070f3;
    `;
    
    const Button = styled.button`
      background: #0070f3;
      color: white;
      border: none;
      border-radius: 4px;
      padding: 10px 16px;
      font-size: 16px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.2s;
      width: 100%;
      margin-top: 12px;
      
      &:hover {
        background: #0060df;
      }
    `;
    
    const Footer = styled.footer`
      margin-top: 60px;
      padding: 40px 0;
      background: #f5f5f5;
      text-align: center;
    `;
    
    // Main App Component
    const EcommerceApp = () => {
      const [products, setProducts] = useState([]);
      const [cart, setCart] = useState([]);
      const [searchTerm, setSearchTerm] = useState('');
      
      // Simulate fetching products
      useEffect(() => {
        // In a real app, this would be an API call
        const fetchProducts = async () => {
          // Simulated product data
          const data = [
            { id: 1, name: 'Wireless Headphones', price: 129.99, image: 'https://example.com/headphones.jpg' },
            { id: 2, name: 'Smartphone', price: 699.99, image: 'https://example.com/smartphone.jpg' },
            { id: 3, name: 'Laptop', price: 1299.99, image: 'https://example.com/laptop.jpg' },
            { id: 4, name: 'Smartwatch', price: 249.99, image: 'https://example.com/smartwatch.jpg' },
            { id: 5, name: 'Wireless Earbuds', price: 89.99, image: 'https://example.com/earbuds.jpg' },
            { id: 6, name: 'Tablet', price: 499.99, image: 'https://example.com/tablet.jpg' },
          ];
          setProducts(data);
        };
        
        fetchProducts();
      }, []);
      
      const addToCart = (product) => {
        setCart([...cart, product]);
      };
      
      const filteredProducts = products.filter(product => 
        product.name.toLowerCase().includes(searchTerm.toLowerCase())
      );
      
      return (
        <>
          <Header>
            <Logo>TechShop</Logo>
            <Nav>
              <NavLink href="#">Home</NavLink>
              <NavLink href="#">Products</NavLink>
              <NavLink href="#">Categories</NavLink>
              <NavLink href="#">Cart ({cart.length})</NavLink>
              <NavLink href="#">Account</NavLink>
            </Nav>
          </Header>
          
          <Container>
            <SearchBar>
              <SearchInput 
                type="text" 
                placeholder="Search products..." 
                value={searchTerm}
                onChange={(e) => setSearchTerm(e.target.value)}
              />
            </SearchBar>
            
            <h2>Featured Products</h2>
            
            <ProductGrid>
              {filteredProducts.map(product => (
                <ProductCard key={product.id}>
                  <ProductImage src={product.image} alt={product.name} />
                  <ProductInfo>
                    <ProductName>{product.name}</ProductName>
                    <ProductPrice>${product.price.toFixed(2)}</ProductPrice>
                    <Button onClick={() => addToCart(product)}>Add to Cart</Button>
                  </ProductInfo>
                </ProductCard>
              ))}
            </ProductGrid>
          </Container>
          
          <Footer>
            <p>&copy; 2025 TechShop. All rights reserved.</p>
          </Footer>
        </>
      );
    };
    
    export default EcommerceApp;
    

    Would you like me to explain or break down this code?

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