Skip to content

Commit

Permalink
Merge pull request storybookjs#21962 from storybookjs/jpzwarte/fix-vi…
Browse files Browse the repository at this point in the history
…ewport-default-orientation

Viewport: Fix the `defaultOrientation` config option
  • Loading branch information
ndelangen authored Apr 6, 2023
2 parents e3bc173 + c1f4580 commit 71b2046
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/addons/viewport/src/Tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export const ViewportTool: FC = memo(
setState({
selected:
defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id),
isRotated: state.isRotated,
isRotated: defaultOrientation === 'landscape',
});
}, [defaultViewport]);
}, [defaultOrientation, defaultViewport]);

const { selected, isRotated } = state;
const item =
Expand Down
9 changes: 9 additions & 0 deletions code/addons/viewport/template/stories/parameters.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export const Selected = {
},
};

export const Orientation = {
parameters: {
viewport: {
defaultViewport: Object.keys(MINIMAL_VIEWPORTS)[0],
defaultOrientation: 'landscape',
},
},
};

export const Custom = {
parameters: {
viewport: {
Expand Down

0 comments on commit 71b2046

Please sign in to comment.