Skip to content

Commit 6fa630e

Browse files
authored
feat: define initial viewport (#1386)
1 parent 8fb9fb4 commit 6fa630e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/docs/src/docs/advanced-config-options.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ Sets whether or not you want the styleguide to load with the pattern info open o
4747

4848
**default**: `false`
4949

50+
## defaultInitialViewportWidth (optional)
51+
52+
Possibility to define whether the initial viewport width on opening pattern lab in the browser should take the default of `100%` (value `true`) or take the (permanently) persisted value after the users have interacted with the viewport resize buttons previously (value `false`). This is especially beneficial in case that you'd expect the pages in full viewport at revisits, and even further if your startpage is defined as a "static" markdown welcome / orientation page.
53+
54+
**default**: `false`
55+
5056
## defaultPatternInfoPanelCode (optional)
5157

5258
Sets default active pattern info code panel by file extension - if unset, uses the value out of _patternExtension_ config value, or instead use value `html` to display the html code initially, or the value defined for the _patternExtension_.

packages/uikit-workshop/src/scripts/lit-components/pl-viewport/pl-viewport.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ class IFrame extends BaseLitComponent {
397397
const url = urlHandler.getFileName(this.getPatternParam());
398398

399399
const initialWidth =
400+
!window.config.defaultInitialViewportWidth &&
400401
store.getState().app.viewportPx &&
401402
store.getState().app.viewportPx <= this.clientWidth
402403
? store.getState().app.viewportPx + 'px;'

0 commit comments

Comments
 (0)