Skip to content

Commit

Permalink
added a preview head to try to fix font loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Francis Thibault committed Oct 5, 2023
1 parent 56db176 commit c7ce183
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 13 deletions.
87 changes: 87 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-Bold.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-BoldItalic.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-Medium.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-MediumItalic.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-Regular.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-SemiBold.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/inter/Inter-SemiBoldItalic.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/abc-favorit/ABCFavorit-Bold.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/abc-favorit/ABCFavorit-Medium.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/abc-favorit/ABCFavorit-Regular.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>

<link
rel="preload"
href="../packages/css/src/font/assets/abc-favorit-mono/ABCFavoritMono-Regular.otf"
as="font"
type="font/otf"
crossorigin="anonymous"
/>
13 changes: 0 additions & 13 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ import { Themes } from "./styles/themes";
// import("@css/font/index.css");
// }

// Use the document.fonts API to check if fonts have loaded
// https://developer.mozilla.org/en-US/docs/Web/API/Document/fonts API to
const fontLoader = async () => ({
fonts: await document.fonts.ready,
});

/* 👇 It's configured as a global loader
* See https://storybook.js.org/docs/react/writing-stories/loaders
* to learn more about loaders
*/
export const loaders = isChromatic() && document.fonts ? [fontLoader] : [];


export const parameters = {
options: {
storySort: {
Expand Down

0 comments on commit c7ce183

Please sign in to comment.