You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: .storybook/preview.js
+20
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,26 @@ import { DarkModeContext } from '../src/context/DarkModeContext';
3
3
import'../src/styles/main.css';
4
4
import'./storybook.css';
5
5
6
+
import{action}from'@storybook/addon-actions';
7
+
8
+
// Gatsby's Link overrides:
9
+
// Gatsby Link calls the `enqueue` & `hovering` methods on the global variable ___loader.
10
+
// This global object isn't set in storybook context, requiring you to override it to empty functions (no-op),
11
+
// so Gatsby Link doesn't throw errors.
12
+
global.___loader={
13
+
enqueue: ()=>{},
14
+
hovering: ()=>{},
15
+
};
16
+
// This global variable prevents the "__BASE_PATH__ is not defined" error inside Storybook.
17
+
global.__BASE_PATH__='/';
18
+
19
+
// Navigating through a gatsby app using gatsby-link or any other gatsby component will use the `___navigate` method.
20
+
// In Storybook, it makes more sense to log an action than doing an actual navigate. Check out the actions addon docs for more info: https://storybook.js.org/docs/react/essentials/actions
0 commit comments