import React from 'react';
import { motion, useReducedMotion } from 'framer-motion';

const fadeUpPreset = (delay = 0, duration = 1.2) => ({
  initial: { opacity: 0, y: 20 },
  whileInView: { opacity: 1, y: 0 },
  viewport: { once: true, amount: 0.2 },
  transition: { delay, duration, ease: "easeOut" }
});

const CoursesSection = () => {
  const shouldReduce = useReducedMotion();

  if (shouldReduce) {
    return (
      <section className="section-padding bg-white">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="bg-nest-gray rounded-lg p-8 lg:p-12">
            <h2 className="text-3xl lg:text-4xl font-bold text-nest-text mb-4">
              Official NestJS Courses
            </h2>
            <p className="text-nest-text-light text-lg mb-8 max-w-3xl">
              Learn from the creators of NestJS. Our comprehensive courses will take you from beginner to expert, covering all aspects of building scalable Node.js applications.
            </p>
            <button className="btn-primary">
              Get started
            </button>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="section-padding bg-white"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <motion.div 
          {...fadeUpPreset(0.2, 0.8)}
          className="bg-nest-gray rounded-lg p-8 lg:p-12"
        >
          <h2 className="text-3xl lg:text-4xl font-bold text-nest-text mb-4">
            Official NestJS Courses
          </h2>
          <p className="text-nest-text-light text-lg mb-8 max-w-3xl">
            Learn from the creators of NestJS. Our comprehensive courses will take you from beginner to expert, covering all aspects of building scalable Node.js applications.
          </p>
          <button className="btn-primary">
            Get started
          </button>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default CoursesSection;