Replies: 3 comments 3 replies
-
I initially struggled with webpack module loading errors with that code above and this was only resolved by renaming |
Beta Was this translation helpful? Give feedback.
-
Discovered the issue was not with the |
Beta Was this translation helpful? Give feedback.
-
Hi, I believe that's better using a combination of preview head + google fonts mdn.
<!-- preview-head.html: Overrides content of preview IFRAME HTML page's <head> tag, affecting rendered component(s) below Canvas and Docs tabs. -->
<!-- Link tag that points to Roboto font resolves to src/assets/fonts/ folder based on start command defined with '-s src/assets' parameter in package.json. -->
<link
rel="preconnect"
href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Outfit:[email protected]&display=swap"
rel="stylesheet" />
<style>
body {
font-family: 'Outfit', serif;
font-optical-sizing: auto;
font-style: normal;
}
</style>
Instead of: <html
lang="en"
className="h-full">
<body className="h-full bg-black text-white">
{children}
</body>
</html> Move those styles to html,
body {
@apply h-full;
}
body {
@apply text-white bg-black;
}
import type { Preview } from '@storybook/react'
import '../app/global.css'
const preview: Preview = {
parameters: {},
}
export default preview |
Beta Was this translation helpful? Give feedback.
-
I'm having difficulty using fonts configured with next/font/google in Storybook. I'm under the impression they should work out of the box. Am I right in assuming you need to configure global decorators to pull in fonts? I've edited the Storybook
preview.tsx
file as shown below but the font for my single component renders with Times New Roman all the time.Beta Was this translation helpful? Give feedback.
All reactions