dermyhughes / gatsby-ghost-blog

Gatsby front end blog using Ghost as headless CMS
MIT License
0 stars 0 forks source link

Prevent text showing before font load #190

Closed dermyhughes closed 7 months ago

codeautopilot[bot] commented 7 months ago

PR summary

The Pull Request aims to improve the user experience by preventing text from showing up on the screen before the custom font ('Permanent Marker') has loaded. This is achieved by setting the visibility of the site banner title to 'hidden' until the font is loaded. A React state hook (isFontLoaded) is used to track the font loading status, and a useEffect hook is implemented to load the font and set the state accordingly. Additionally, a timeout is set to force the state to true after 3 seconds, ensuring that the text becomes visible even if the font fails to load for some reason. The PR also modifies the font loading strategy by changing the font-display property to 'block' in both the CSS and the HTML link element.

Suggestion

The PR seems well-implemented for the intended purpose. However, it might be beneficial to consider the following: