import { useEffect, useState } from 'react';

const useResize = () => {
  const [windowSize, setWindowSize] = useState({
    width: window.innerWidth,
    height: window.innerHeight,
    isPCSize: window.innerWidth >= 1440,
    isMobileSize: window.innerWidth < 1440,
  });

  useEffect(() => {
    const handleResize = () => {
      setWindowSize({
        width: window.innerWidth,
        height: window.innerHeight,
        isPCSize: window.innerWidth >= 1440,
        isMobileSize: window.innerWidth < 1440,
      });
    };

    window.addEventListener('resize', handleResize);

    return () => window.removeEventListener('resize', handleResize);
  }, []);
  return windowSize;
};

export default useResize;
