-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #589 from open-formulieren/task/36-refactor-cleanu…
…p-progress-indicator [#36] Refactor Progress Indicator
- Loading branch information
Showing
32 changed files
with
1,073 additions
and
1,074 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const {getStoryContext} = require('@storybook/test-runner'); | ||
const {MINIMAL_VIEWPORTS} = require('@storybook/addon-viewport'); | ||
|
||
const DEFAULT_VIEWPORT_SIZE = {width: 1280, height: 720}; | ||
|
||
module.exports = { | ||
async preRender(page, story) { | ||
const context = await getStoryContext(page, story); | ||
const viewportName = context.parameters?.viewport?.defaultViewport; | ||
const viewportParameter = MINIMAL_VIEWPORTS[viewportName]; | ||
|
||
if (viewportParameter) { | ||
const viewportSize = Object.entries(viewportParameter.styles).reduce( | ||
(acc, [screen, size]) => ({ | ||
...acc, | ||
// make sure your viewport config in Storybook only uses numbers, not percentages | ||
[screen]: parseInt(size), | ||
}), | ||
{} | ||
); | ||
|
||
page.setViewportSize(viewportSize); | ||
} else { | ||
page.setViewportSize(DEFAULT_VIEWPORT_SIZE); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.