Skip to content

Commit 784afa8

Browse files
committed
reset scroll story decorator
1 parent 4766db5 commit 784afa8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.storybook/config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ const CenterDecorator = storyFn => (
1212
</div>
1313
);
1414

15-
addDecorator(CenterDecorator);
15+
// reset the window on each story
16+
const withWindowReset = storyFn => {
17+
window.scrollTo(0, 0);
18+
return storyFn();
19+
};
20+
1621
addDecorator(withKnobs);
22+
addDecorator(withWindowReset);
23+
addDecorator(CenterDecorator);
1724

1825
const req = require.context('../stories', true, /\.stories\.js$/);
1926

0 commit comments

Comments
 (0)