Skip to content

Commit

Permalink
fix: correct off by one error and align all breakpoint values to work…
Browse files Browse the repository at this point in the history
… together (#530)
  • Loading branch information
wp-aberg authored Nov 6, 2023
1 parent b261af1 commit 7b3bc1c
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .storybook/test-runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { getStoryContext } = require("@storybook/test-runner");

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 =
context.parameters?.viewport?.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);
}
},
};
Loading

4 comments on commit 7b3bc1c

@vercel
Copy link

@vercel vercel bot commented on 7b3bc1c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7b3bc1c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit-vitejs-example – ./apps/vite-project

wpds-ui-kit-vitejs-example.preview.now.washingtonpost.com
wpds-ui-kit-vitejs-example-git-main.preview.now.washingtonpost.com

@vercel
Copy link

@vercel vercel bot commented on 7b3bc1c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit – ./build.washingtonpost.com

build.washingtonpost.com
wpds-ui-kit-git-main.preview.now.washingtonpost.com
wpds-ui-kit.preview.now.washingtonpost.com

@vercel
Copy link

@vercel vercel bot commented on 7b3bc1c Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit-storybook – ./

wpds-ui-kit-storybook.preview.now.washingtonpost.com
wpds-ui-kit-storybook-git-main.preview.now.washingtonpost.com

Please sign in to comment.