import { useEffect , useState } from 'react' ; const useIsFontsLoaded = ( ) : boolean => { const [ isFontsLoaded , setIsFontsLoaded ] = useState ( false ) ; useEffect ( ( ) => { if ( process . env . NODE_ENV === 'test' ) { return ; } let isMounted = true ; const FontFaceObserver = require ( 'fontfaceobserver' ) ; const WB = new FontFaceObserver ( 'Wellcome Bold Web' , { weight : 'bold' } ) ; const HNR = new FontFaceObserver ( 'Helvetica Neue Roman Web' ) ; const HNB = new FontFaceObserver ( 'Helvetica Neue Bold Web' ) ; const LR = new FontFaceObserver ( 'Lettera Regular Web' ) ; Promise . all ( [ WB . load ( null ) , HNR . load ( null ) , HNB . load ( null ) , LR . load ( null ) ] ) . then ( ( ) => { if ( isMounted ) { setIsFontsLoaded ( true ) ; } } ) . catch ( console . error ) ; return ( ) => { isMounted = false ; } ; } , [ ] ) ; return isFontsLoaded ; } ; export default useIsFontsLoaded ;