Skip to content

Commit a5be07b

Browse files
committed
fix: update PL code viewer to open and resize as expected + animate much more performantly using CSS transforms; update existing JS logic to clean up inlined CSS styles when closing PL modal / code viewer panel
1 parent 16f8fe4 commit a5be07b

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

packages/uikit-workshop/src/sass/scss/02-base/_body.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
padding: 0;
1313
background: $pl-color-gray-13;
1414
-webkit-text-size-adjust: 100%;
15+
display: flex;
16+
flex-direction: column;
17+
height: 100vh;
1518
}

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
* "show pattern info" is selected on the pattern detail screen.
88
*/
99
.pl-c-modal {
10-
display: none;
10+
display: flex;
11+
flex-direction: column;
1112
font-family: $pl-font;
1213
background: $pl-color-black;
1314
color: $pl-color-gray-20;
@@ -17,16 +18,21 @@
1718
left: 0;
1819
z-index: 5;
1920
width: 100%;
20-
height: 50%;
21-
transition: bottom 0.3s ease-out;
21+
height: 0;
22+
transition: transform 0.3s ease, height 0.3s ease;
23+
transform: translate3d(0, 100%, 0);
24+
pointer-events: none;
25+
will-change: height, transform;
26+
overflow: hidden;
2227

2328
/**
2429
* Active modal
2530
*/
2631
&.pl-is-active {
27-
display: flex;
28-
flex-direction: column;
29-
bottom: 0;
32+
transform: translate3d(0, 0, 0);
33+
height: 50vh; // default height unless manually resized
34+
transition: transform 0.3s ease;
35+
pointer-events: auto;
3036
}
3137
}
3238

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
.pl-c-viewport {
1616
display: flex;
1717
flex-direction: column;
18-
height: 100vh;
18+
flex-direction: column;
19+
height: auto;
1920
width: 100%;
2021
position: relative;
2122
top: $offset-top;
@@ -24,6 +25,14 @@
2425
right: 0;
2526
z-index: 0;
2627
overflow: hidden;
28+
flex-grow: 1;
29+
transition: height 0.3s ease;
30+
transform: translate3d(0, 0, 0);
31+
will-change: height;
32+
33+
@supports (position: sticky) {
34+
top: 0;
35+
}
2736
}
2837

2938
/**

packages/uikit-workshop/src/scripts/components/modal-viewer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export const modalViewer = {
124124

125125
//Remove active class to modal
126126
$('.pl-js-modal').removeClass('pl-is-active');
127+
$('.pl-js-modal').removeAttr('style'); // remove inline height CSS
127128

128129
// WIP: refactoring viewport panel to use CSS vars to resize
129130
// $('html').css('--pl-viewport-height', window.innerHeight - 32 + 'px');
@@ -145,6 +146,7 @@ export const modalViewer = {
145146
*/
146147
hide: function() {
147148
$('.pl-js-modal').removeClass('pl-is-active');
149+
$('.pl-js-modal').removeAttr('style'); // remove inline height CSS
148150

149151
// WIP: refactoring viewport panel to use CSS vars to resize
150152
// $('html').css(

0 commit comments

Comments
 (0)