mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore(site): fix storybook font issue (#14137)
This commit is contained in:
@ -11,6 +11,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
|
|||||||
import { HelmetProvider } from "react-helmet-async";
|
import { HelmetProvider } from "react-helmet-async";
|
||||||
import themes from "theme";
|
import themes from "theme";
|
||||||
import "theme/globalFonts";
|
import "theme/globalFonts";
|
||||||
|
import isChromatic from "chromatic/isChromatic";
|
||||||
|
|
||||||
DecoratorHelpers.initializeThemeState(Object.keys(themes), "dark");
|
DecoratorHelpers.initializeThemeState(Object.keys(themes), "dark");
|
||||||
|
|
||||||
@ -102,3 +103,11 @@ function withQuery(Story, { parameters }) {
|
|||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to fix storybook rendering fonts inconsistently
|
||||||
|
// https://www.chromatic.com/docs/font-loading/#solution-c-check-fonts-have-loaded-in-a-loader
|
||||||
|
const fontLoader = async () => ({
|
||||||
|
fonts: await document.fonts.ready,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const loaders = isChromatic() && document.fonts ? [fontLoader] : [];
|
||||||
|
Reference in New Issue
Block a user