Skip to content

Commit 87fd545

Browse files
author
Ives van Hoorne
committed
Make Preview fullscreen for certain screen widths
1 parent 17ac5e9 commit 87fd545

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/common/url.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,13 @@ export const getSandboxOptions = () => {
99
result.isPreviewScreen = location.search.includes('view=preview');
1010
result.isEditorScreen = location.search.includes('view=editor');
1111

12+
// If there is no view specified and the width of the window is <800 we want
13+
// to default to preview
14+
if (!result.isPreviewScreen && !result.isEditorScreen) {
15+
const windowWidth =
16+
window.innerWidth || document.documentElement.clientWidth;
17+
result.isPreviewScreen = windowWidth < 800;
18+
}
19+
1220
return result;
1321
};

0 commit comments

Comments
 (0)