text: //IMPORTING
  import React, { useState, useRef, useEffect } from 'react';
  import styled, { css, keyframes } from 'styled-components/macro';
  import { Button } from './Button';
  import { IoMdArrowRoundForward } from 'react-icons/io';
  import { IoArrowForward, IoArrowBack } from 'react-icons/io5';
  
  //HERO SECTION
  const HeroSection = styled.section`
    height: 100vh;
    max-height: 1100px;
    position: relative;
    overflow: hidden;
  `;
  
  //HERO WRAPPER
  const HeroWrapper = styled.div`
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
  `;
  
  //HERO SLIDE
  const HeroSlide = styled.div`
    z-index: 1;
    width: 100%;
    height: 100%;
  `;
  
  //HERO SLIDER
  const HeroSlider = styled.div`
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  
    &::before {
      content: '';
      position: absolute;
      z-index: 2;
      width: 100%;
      height: 100vh;
      bottom: 0vh;
      left: 0;
      overflow: hidden;
      opacity: 0.4;
      background: linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.6) 100%
      );
    }
  `;
  
  //FADE IN
  const fadeIn = keyframes`
    from {
      opacity: 0;
    }
  
    to {
      opacity: 1;
    }
  `;
  
  //FADE IN DOWN
  const fadeInDown = keyframes`
    from {
      opacity: 0;
      -webkit-transform: translate3d(0, -100%, 0);
      transform: translate3d(0, -100%, 0);
    }
  
    to {
      opacity: 1;
      -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
    }
  `;
  
  //HERO IMAGE
  const HeroImage = styled.img`
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    animation: ${fadeIn} 2s;
  `;
  
  //HERO CONTENT
  const HeroContent = styled.div`
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    width: calc(100% - 100px);
    color: #fff;
  
    h1 {
      font-size: clamp(1rem, 8vw, 2rem);
      font-weight: 400;
      text-transform: uppercase;
      text-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4);
      text-align: left;
      margin-bottom: 0.8rem;
      animation: ${fadeInDown} 1s both;
      animation-delay: 0s;
    }
  
    p {
      margin-bottom: 1.2rem;
      text-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4);
      animation: ${fadeInDown} 1s both;
      animation-delay: 0.5s;
    }
  
    ${Button} {
      animation: ${fadeIn} 1s both;
      animation-delay: 1s;
    }
  `;
  
  //ARROW
  const Arrow = styled(IoMdArrowRoundForward)`
    margin-left: 0.5rem;
  `;
  
  //SLIDER BUTTON
  const SliderButton = styled.div`
    position: absolute;
    bottom: 50px;
    right: 50px;
    display: flex;
    z-index: 10;
  `;
  
  //ARROW BUTTONS
  const arrowButtons = css`
    width: 50px;
    height: 50px;
    color: #fff;
    cursor: pointer;
    background: #000d1a;
    border-radius: 50px;
    padding: 10px;
    margin-right: 1rem;
    user-select: none;
    transition: 0.3s;
  
    &:hover {
      background: #696969;
      transform: scale(1.05);
    }
  `;
  
  //PREV ARROW
  const PrevArrow = styled(IoArrowBack)`
    ${arrowButtons};
  `;
  
  //NEXT ARROW
  const NextArrow = styled(IoArrowForward)`
    ${arrowButtons};
  `;
  
  //HERO
  const Hero = ({ slides }) => {
    const [current, setCurrent] = useState(0);
    const length = slides.length;
    const timeout = useRef(null);
  
    //USE EFFECT
    useEffect(() => {
      const nextSlide = () => {
        setCurrent((current) => (current === length - 1 ? 0 : current + 1));
      };
  
      timeout.current = setTimeout(nextSlide, 5000);
  
      return function () {
        clearTimeout(timeout.current);
      };
    }, [current, length]);
  
    //NEXT SLIDE
    const nextSlide = () => {
      setCurrent(current === length - 1 ? 0 : current + 1);
      if (timeout.currnet) {
        clearTimeout(timeout.current);
      }
    };
  
    //PREV SLIDE
    const prevSlide = () => {
      setCurrent(current === 0 ? length - 1 : current - 1);
      if (timeout.currnet) {
        clearTimeout(timeout.current);
      }
    };
  
    if (!Array.isArray(slides) || slides.length <= 0) {
      return null;
    }
  
    //RETURN
    return (
      <HeroSection name="/home">
        <HeroWrapper>
          {slides.map((slide, index) => {
            return (
              <HeroSlide key={index}>
                {index === current && (
                  <HeroSlider>
                    <HeroImage src={slide.image} alt={slide.alt} />
                    <HeroContent>
                      <h1>{slide.title}</h1>
                      <p>{slide.price}</p>
                      <Button
                        to={slide.path}
                        primary="true"
                        css={`
                          max-width: 160px;
                        `}
                      >
                        {slide.label}
                        <Arrow />
                      </Button>
                    </HeroContent>
                  </HeroSlider>
                )}
              </HeroSlide>
            );
          })}
          <SliderButton>
            <PrevArrow onClick={prevSlide} />
            <NextArrow onClick={nextSlide} />
          </SliderButton>
        </HeroWrapper>
      </HeroSection>
    );
  };
  
  export default Hero;
  