'use client'
import { useState, useEffect } from 'react'

const useGetResponsiveView = () => {
  const [isMobileView, setIsMobileView] = useState(true)
  const [isComputerView, setIsComputerView] = useState(false)

  const handleResize = () => {
    const width = window.innerWidth
    setIsMobileView(width < 768)
    setIsComputerView(width >= 768)
  }

  useEffect(() => {
    handleResize()

    window.addEventListener('resize', handleResize)

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

  return { isMobileView, isComputerView }
}

export default useGetResponsiveView
