import { useEffect, useState } from 'react'

export function useFontsLoaded() {
  const [fontsLoaded, setFontsLoaded] = useState(false)

  useEffect(() => {
    document.fonts.ready
      .then(() => {
        setFontsLoaded(true)
      })
      .catch((error) => {
        console.error('Failed to load fonts:', error)
      })
  }, [])

  return fontsLoaded
}
