Skip to content

Commit

Permalink
feat: define initial viewport (pattern-lab#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed Dec 4, 2021
1 parent d20b5a1 commit eae2087
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/docs/src/docs/advanced-config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Sets whether or not you want the styleguide to load with the pattern info open o

**default**: `false`

## defaultInitialViewportWidth (optional)

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.

**default**: `false`

## defaultPatternInfoPanelCode (optional)

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_.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ class IFrame extends BaseLitComponent {
const url = urlHandler.getFileName(this.getPatternParam());

const initialWidth =
!window.config.defaultInitialViewportWidth &&
store.getState().app.viewportPx &&
store.getState().app.viewportPx <= this.clientWidth
? store.getState().app.viewportPx + 'px;'
Expand Down

0 comments on commit eae2087

Please sign in to comment.