@@ -4,15 +4,16 @@ import CssBaseline from "@mui/material/CssBaseline";
4
4
import {
5
5
ThemeProvider as MuiThemeProvider ,
6
6
StyledEngineProvider ,
7
- // biome-ignore lint/style/noRestrictedImports: we extend the MUI theme
8
7
} from "@mui/material/styles" ;
9
8
import { DecoratorHelpers } from "@storybook/addon-themes" ;
10
9
import isChromatic from "chromatic/isChromatic" ;
11
10
import { StrictMode } from "react" ;
12
- import { HelmetProvider } from "react-helmet-async" ;
11
+ import { Helmet , HelmetProvider } from "react-helmet-async" ;
13
12
import { QueryClient , QueryClientProvider } from "react-query" ;
14
13
import { withRouter } from "storybook-addon-remix-react-router" ;
15
14
import "theme/globalFonts" ;
15
+ //@ts -expect-error -- This is throwing an error because of the ?url at then end of the import. It is a Vite feature to import the URL of an asset.
16
+ import interWoff2 from "@fontsource-variable/inter/files/inter-latin-wght-normal.woff2?url" ;
16
17
import type { Decorator , Loader , Parameters } from "@storybook/react-vite" ;
17
18
import themes from "../src/theme" ;
18
19
@@ -65,6 +66,15 @@ export const parameters: Parameters = {
65
66
const withHelmet :Decorator = ( Story ) => {
66
67
return (
67
68
< HelmetProvider >
69
+ < Helmet >
70
+ < link
71
+ rel = "preload"
72
+ as = "font"
73
+ type = "font/woff2"
74
+ href = { interWoff2 }
75
+ crossOrigin = "anonymous"
76
+ />
77
+ </ Helmet >
68
78
< Story />
69
79
</ HelmetProvider >
70
80
) ;
@@ -95,8 +105,8 @@ const withQuery: Decorator = (Story, { parameters }) => {
95
105
96
106
const withTheme :Decorator = ( Story , context ) => {
97
107
const selectedTheme = DecoratorHelpers . pluckThemeFromContext ( context ) ;
98
- const { themeOverride } = DecoratorHelpers . useThemeParameters ( ) ;
99
- const selected = themeOverride || selectedTheme || "dark" ;
108
+ const themeParameters = DecoratorHelpers . useThemeParameters ( ) ;
109
+ const selected = themeParameters ?. themeOverride || selectedTheme || "dark" ;
100
110
101
111
// Ensure the correct theme is applied to Tailwind CSS classes by adding the
102
112
// theme to the HTML class list. This approach is necessary because Tailwind