web: add `Source Sans Pro` font to `LoggedOutHomepage`
Created by: valerybugakov
Changes
- Added React hook
useDynamicWebFonts
to load custom fonts dynamically using CSS Font Loading Module API. If fonts are available — network requests are skipped. Otherwise, native API loads them from our assets folder and attaches them to the document. - Configured fonts necessary for
LoggedOutHomepage
based on the Figma mockups. Two families of Source Sans Pro:Regular 400
andBold 700
. - Wrapped the
LoggedOutHomepage
component into a helper aDynamicWebFonts
component to wait for custom fonts to load and avoid content jumps.
Notes
Global types are modified to add support for the document.fonts
API. These types live next to the useDynamicWebFonts
hook at the moment. They need to be moved to the global types directory. It's not done because of time constraints.
Closes https://github.com/sourcegraph/sourcegraph/issues/24017