Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0536a14

Browse files
authored
chore: fix storybook fonts (#988)
Summary:Configures storybook with MUI themes as according to theirdocumentation. We were previously not aligned with their example.See:https://storybook.js.org/addons/@react-theming/storybook-addonDetails:- configure a providerFn for MUI with CssBaseline. We were previouslymissing the CssBaseline implementation, causing the inconsistency.Impact:Resolves inconsistency between Storybook and production. I had testedthe Tabpanel in production vs Storybook. In storybook, the font hadfallen back to Times New Roman, whereas in production it had fallen backto Inter. This was because of CssBaseline being configured as a child ofThemeProvider.Resolves:#914
1 parent6edd7cb commit0536a14

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎site/.storybook/preview.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
importCssBaselinefrom"@material-ui/core/CssBaseline"
12
importThemeProviderfrom"@material-ui/styles/ThemeProvider"
23
import{withThemes}from"@react-theming/storybook-addon"
34
import{createMemoryHistory}from"history"
@@ -6,7 +7,14 @@ import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
67
import{dark,light}from"../src/theme"
78
import"../src/theme/global-fonts"
89

9-
addDecorator(withThemes(ThemeProvider,[light,dark]))
10+
constproviderFn=({ children, theme})=>(
11+
<ThemeProvidertheme={theme}>
12+
<CssBaseline/>
13+
{children}
14+
</ThemeProvider>
15+
)
16+
17+
addDecorator(withThemes(null,[light,dark],{ providerFn}))
1018

1119
consthistory=createMemoryHistory()
1220

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp