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 Courses = () => {
  const shouldReduce = useReducedMotion();

  if (shouldReduce) {
    return (
      <section className="py-20 bg-nest-light-gray">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="bg-white rounded-lg p-12 text-center">
            <h2 className="text-3xl font-bold text-nest-dark mb-4">
              Official NestJS Courses
            </h2>
            <p className="text-nest-gray mb-8 max-w-2xl mx-auto">
              Learn NestJS from the ground up with our comprehensive courses. From beginner to advanced topics, we've got you covered.
            </p>
            <button className="btn-primary">
              Get started
            </button>
          </div>
        </div>
      </section>
    );
  }

  return (
    <motion.section 
      {...fadeUpPreset(0.1, 1.0)}
      className="py-20 bg-nest-light-gray"
    >
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <motion.div 
          {...fadeUpPreset(0.2, 0.8)}
          className="bg-white rounded-lg p-12 text-center"
        >
          <h2 className="text-3xl font-bold text-nest-dark mb-4">
            Official NestJS Courses
          </h2>
          <p className="text-nest-gray mb-8 max-w-2xl mx-auto">
            Learn NestJS from the ground up with our comprehensive courses. From beginner to advanced topics, we've got you covered.
          </p>
          <button className="btn-primary">
            Get started
          </button>
        </motion.div>
      </div>
    </motion.section>
  );
};

export default Courses;