Skip to content

Commit c0fcd6f

Browse files
committed
fix: update viewport CSS to prevent JS from exceeding the maximum size of the page; update to account for vertical vs horizontal layouts
1 parent ba0ca74 commit c0fcd6f

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

packages/uikit-workshop/src/sass/scss/01-abstracts/_variables.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ $pl-animate-normal: 0.3s;
5353
// Borders
5454
$pl-border-radius: 3px;
5555
$pl-border-radius-med: 6px;
56+
57+
58+
$pl-sidebar-width: 14rem; //Define sidebar width for calculating dimensions

packages/uikit-workshop/src/sass/scss/04-components/_modal.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
pointer-events: none;
2525
will-change: height, transform;
2626
overflow: hidden;
27+
max-width: 100vw;
28+
29+
.pl-c-body--theme-sidebar & {
30+
@media all and (min-width: $pl-bp-med) {
31+
max-width: calc(100vw - #{$pl-sidebar-width});
32+
}
33+
}
2734

2835
/**
2936
* Active modal

packages/uikit-workshop/src/sass/scss/04-components/_viewport.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
left: 0;
8787
right: 0;
8888
background-color: $pl-color-white;
89+
max-width: 100vw; // https://github.com/bolt-design-system/bolt/pull/868
90+
91+
.pl-c-body--theme-sidebar & {
92+
@media all and (min-width: $pl-bp-med) {
93+
max-width: calc(100vw - #{$pl-sidebar-width} + 14px);
94+
}
95+
}
8996

9097
/**
9198
* Hay Mode transition
@@ -141,3 +148,17 @@
141148
.vp-animate {
142149
transition: width 0.8s ease-out;
143150
}
151+
152+
// wrapper so the iframe + modal can switch flex directions in vertical vs horizontal layouts
153+
.pl-c-viewport-modal-wrapper {
154+
display: flex;
155+
flex-grow: 1;
156+
flex-direction: column;
157+
max-width: calc(100vw);
158+
159+
.pl-c-body--theme-sidebar & {
160+
@media all and (min-width: $pl-bp-med) {
161+
max-width: calc(100vw - #{$pl-sidebar-width});
162+
}
163+
}
164+
}

0 commit comments

Comments
 (0)