Skip to content
The Chat Archive
claude-3-5-haiku-20241022· Anthropic LMArena Human Preference 140K

// src/components/Hero.jsx import { motion } from 'framer-motion'; const Hero = () => {…

  1. User

    // src/components/Hero.jsx import { motion } from 'framer-motion';

    const Hero = () => { const containerVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { staggerChildren: 0.2, }, }, };

    const childVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0 }, };

    const buttonVariants = { hover: { scale: 1.03 }, tap: { scale: 0.97 }, };

    return ( <motion.div variants={containerVariants} initial="hidden" animate="visible" className="max-w-3xl mx-auto text-center" > <motion.h1 variants={childVariants} className="text-4xl md:text-5xl font-bold text-slate-900 mb-4 leading-tight" > Crafting Excellence in Hardware </motion.h1> <motion.p variants={childVariants} className="text-lg text-slate-600 mb-8" > Discover our range of premium tools and equipment, designed for professionals and DIY enthusiasts alike. </motion.p> <motion.button variants={buttonVariants} whileHover="hover" whileTap="tap" className="bg-slate-800 text-white px-6 py-2.5 rounded-full font-medium text-sm shadow-md transition-all duration-200 hover:shadow-lg" > Explore Our Collection </motion.button> <motion.button variants={buttonVariants} whileHover="hover" whileTap="tap" className="bg-white text-slate-800 border border-slate-200 px-6 py-2.5 rounded-full font-medium text-sm shadow-md transition-all duration-200 hover:shadow-lg" > Learn More </motion.button> </motion.div>

      {/* Decorative Elements */}
      <div className="absolute inset-0 overflow-hidden pointer-events-none">
        <div className="absolute -left-8 top-1/3 w-32 h-32 bg-blue-400 rounded-full blur-3xl opacity-10" />
        <div className="absolute right-1/4 bottom-1/3 w-40 h-40 bg-purple-400 rounded-full blur-3xl opacity-10" />
      </div>
    
      {/* Infinite Scroll Products */}
      <div className="absolute bottom-0 left-0 w-full py-6 bg-gradient-to-t from-white to-transparent">
        <div className="overflow-hidden">
          <motion.div
            initial={{ x: 0 }}
            animate={{ x: '-100%' }}
            transition={{ duration: 30, repeat: Infinity, ease: 'linear' }}
            className="flex"
          >
            {[...Array(10).keys()].map((_, index) => (
              <div key={index} className="mx-4 w-40 flex-shrink-0">
                <img
                  src={`https://picsum.photos/200/300?random=${index}`}
                  alt={`Product ${index}`}
                  className="w-full h-24 object-cover rounded-lg mb-2"
                />
                <p className="text-sm text-slate-600 text-center">Product {index}</p>
              </div>
            ))}
          </motion.div>
        </div>
      </div>
    </div>
    

    ); };

    export default Hero; update this make it more bettter and beautiful and modern

  2. Assistant

    Here's an enhanced, more modern and beautiful version of the Hero component:

    // src/components/Hero.jsx
    import { motion } from 'framer-motion';
    import { FaTools, FaShoppingCart, FaInfoCircle } from 'react-icons/fa';
    
    const productData = [
      { name: 'Professional Drill', icon: '🔧', color: 'bg-blue-100' },
      { name: 'Precision Saw', icon: '🪚', color: 'bg-green-100' },
      { name: 'Advanced Sander', icon: '🛠️', color: 'bg-purple-100' },
      { name: 'Compact Wrench Set', icon: '🔨', color: 'bg-red-100' },
      { name: 'Laser Measure', icon: '📏', color: 'bg-indigo-100' },
    ];
    
    const Hero = () => {
      const containerVariants = {
        hidden: { opacity: 0, y: 20 },
        visible: {
          opacity: 1,
          y: 0,
          transition: {
            delayChildren: 0.3,
            staggerChildren: 0.2,
          },
        },
      };
    
      const childVariants = {
        hidden: { opacity: 0, y: 20 },
        visible: { 
          opacity: 1, 
          y: 0,
          transition: {
            type: "spring",
            damping: 12,
            stiffness: 100
          }
        },
      };
    
      const buttonVariants = {
        hover: { 
          scale: 1.05,
          transition: { duration: 0.2 }
        },
        tap: { 
          scale: 0.95,
          transition: { duration: 0.2 }
        },
      };
    
      return (
        <div className="relative min-h-screen bg-gradient-to-b from-slate-50 to-white pt-20 overflow-hidden">
          {/* Main Content */}
          <div className="container mx-auto px-4 h-full flex items-center justify-center relative z-10">
            <motion.div
              variants={containerVariants}
              initial="hidden"
              animate="visible"
              className="max-w-4xl mx-auto text-center"
            >
              <motion.div 
                variants={childVariants}
                className="inline-flex items-center mb-4 bg-slate-100 px-4 py-2 rounded-full"
              >
                <FaTools className="mr-2 text-slate-700" />
                <span className="text-sm text-slate-800">Professional Hardware Solutions</span>
              </motion.div>
    
              <motion.h1
                variants={childVariants}
                className="text-5xl md:text-6xl font-extrabold text-slate-900 mb-6 leading-tight"
              >
                Elevate Your Craft with <br />
                <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600">
                  Precision Tools
                </span>
              </motion.h1>
    
              <motion.p
                variants={childVariants}
                className="text-xl text-slate-600 mb-8 max-w-2xl mx-auto"
              >
                Unleash your potential with our meticulously engineered tools, designed to transform your professional and DIY projects.
              </motion.p>
    
              <motion.div 
                variants={childVariants}
                className="flex gap-4 justify-center"
              >
                <motion.button
                  variants={buttonVariants}
                  whileHover="hover"
                  whileTap="tap"
                  className="flex items-center gap-2 bg-slate-900 text-white px-8 py-3 rounded-full font-semibold text-sm shadow-xl shadow-slate-300 hover:bg-slate-800 transition-all"
                >
                  <FaShoppingCart />
                  Explore Collection
                </motion.button>
                <motion.button
                  variants={buttonVariants}
                  whileHover="hover"
                  whileTap="tap"
                  className="flex items-center gap-2 bg-white text-slate-800 border border-slate-200 px-8 py-3 rounded-full font-semibold text-sm shadow-md hover:shadow-lg transition-all"
                >
                  <FaInfoCircle />
                  Learn More
                </motion.button>
              </motion.div>
            </motion.div>
          </div>
    
          {/* Product Showcase */}
          <motion.div 
            initial={{ opacity: 0, y: 50 }}
            animate={{ opacity: 1, y: 0 }}
            transition={{ delay: 0.5 }}
            className="absolute bottom-0 left-0 w-full py-8 bg-gradient-to-t from-white/70 to-transparent"
          >
            <div className="container mx-auto px-4">
              <div className="flex justify-center space-x-6">
                {productData.map((product, index) => (
                  <motion.div
                    key={index}
                    initial={{ opacity: 0, y: 20 }}
                    animate={{ opacity: 1, y: 0 }}
                    transition={{ delay: 0.6 + index * 0.1 }}
                    className="flex flex-col items-center"
                  >
                    <div className={`w-16 h-16 ${product.color} rounded-full flex items-center justify-center text-3xl mb-2`}>
                      {product.icon}
                    </div>
                    <p className="text-sm text-slate-600">{product.name}</p>
                  </motion.div>
                ))}
              </div>
            </div>
          </motion.div>
    
          {/* Subtle Background Blurs */}
          <div className="absolute inset-0 overflow-hidden pointer-events-none">
            <div className="absolute -left-16 -top-16 w-64 h-64 bg-blue-300 rounded-full blur-3xl opacity-10" />
            <div className="absolute -right-16 -bottom-16 w-72 h-72 bg-purple-300 rounded-full blur-3xl opacity-10" />
          </div>
        </div>
      );
    };
    
    export default Hero;
    

    Key Enhancements:

    1. Typography and Layout:

      • Larger, more impactful typography
      • Gradient text effect for the main headline
      • Added a professional tag with an icon
    2. Button Design:

      • Added icons to buttons
      • More pronounced shadow and hover effects
      • Improved color contrast and interaction states
    3. Product Showcase:

      • Replaced infinite scroll with a static, animated product showcase
      • Used emoji icons and colored backgrounds for visual interest
      • Staggered animation for each product item
    4. Animation:

      • More sophisticated Framer Motion animations
      • Spring-based transitions for a more natural feel
      • Staggered and delayed animations
    5. Color Scheme:

      • Soft, modern color palette
      • Subtle background blurs
      • Gradient backgrounds and text
    6. Responsiveness:

      • Maintained responsive design
      • Flexible container and padding
    7. Additional Touches:

      • Used React Icons for better iconography
      • Added more descriptive text
      • Created a more cohesive and professional look

    Dependencies:

    • framer-motion
    • react-icons

    This design aims to create a modern, premium feel with sophisticated animations, typography, and layout. The focus is on creating an engaging and professional first impression.