Skip to content

Commit ede0b8c

Browse files
authored
Merge pull request #1097 from pattern-lab/fix/uikit-bug-fixes
Follow-up UIKit Fixes
2 parents 017b855 + 98e9baf commit ede0b8c

File tree

18 files changed

+128
-165
lines changed

18 files changed

+128
-165
lines changed

packages/uikit-workshop/src/sass/pattern-lab.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
/*------------------------------------*\
4444
#COMPONENTS
4545
\*------------------------------------*/
46-
4746
@import '../scripts/components/pl-nav/pl-nav.scss';
4847
@import '../scripts/components/pl-search/pl-search.scss';
4948
@import '../scripts/components/pl-tooltip/pl-tooltip.scss';
@@ -112,6 +111,10 @@
112111
}
113112
}
114113

114+
.pl-c-body {
115+
overflow: hidden;
116+
}
117+
115118
.pl-c-main {
116119
overflow: hidden;
117120
max-width: 100vw;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
@mixin accordionPanel() {
7474
overflow: hidden;
7575
max-height: 0;
76-
transition: max-height $pl-animate-quick ease-out;
76+
transition: all $pl-animate-quick ease-out;
7777

7878
/**
7979
* Active styles for when the accordion panel is open

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
margin-bottom: 0.5rem;
1313
display: flex;
1414
font-size: $pl-font-size-sm;
15-
color: currentColor;
15+
color: inherit;
1616
text-transform: capitalize;
1717
}
1818

1919
/**
2020
* Breadcrumb Item
2121
*/
2222
.pl-c-breadcrumb__item {
23+
color: inherit;
2324
&:after {
2425
content: '\25b6';
2526
opacity: 0.4;

packages/uikit-workshop/src/sass/scss/04-components/_pattern-info.scss

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
.pl-c-pattern & {
2020
max-height: 30rem;
2121
overflow: scroll;
22-
display: flex;
22+
display: block;
2323
-webkit-overflow-scrolling: touch;
2424

2525
@media all and (min-width: $pl-bp-large) {
2626
max-height: none;
2727
height: 18rem;
28+
display: flex;
2829
flex-direction: row;
2930
overflow: visible;
3031
}
@@ -52,16 +53,19 @@
5253
* Right side contains pattern code
5354
*/
5455
.pl-c-pattern-info__panel {
55-
padding: 1rem;
56-
width: auto;
57-
flex-shrink: 0;
56+
padding: .5rem;
57+
flex-shrink: 0; // prevent panel from collapsing in height (especially on smaller screens like iPhone)
5858
display: flex;
5959
flex-direction: column;
6060

61+
pl-drawer & {
62+
padding: 1rem;
63+
}
64+
6165
@media all and (min-width: $pl-bp-large) {
6266
flex-basis: 50%;
6367
flex-grow: 1;
64-
overflow: auto;
68+
padding: 1.5rem;
6569
}
6670
}
6771

@@ -77,7 +81,7 @@
7781
}
7882

7983
@media all and (min-width: $pl-bp-xl) {
80-
width: 55%;
84+
min-width: 50%;
8185
}
8286
}
8387

@@ -92,11 +96,14 @@
9296
.pl-c-pattern-info__panel--info + .pl-c-pattern-info__panel--code,
9397
.pl-c-pattern-info__panel--code:first-child {
9498
flex-grow: 1;
95-
flex-shrink: 1;
99+
flex-shrink: 0; // so the code panel doesn't get chopped off accidently
100+
min-width: 50%;
96101
}
97102

98-
.pl-c-pattern-info__panel--code:first-child {
99-
padding-top: 0;
103+
.pl-c-pattern-info__panel--info + .pl-c-pattern-info__panel--code {
104+
@media all and (max-width: $pl-bp-large) {
105+
padding-top: 0;
106+
}
100107
}
101108

102109
/**
@@ -111,7 +118,7 @@
111118
*/
112119
.pl-c-pattern-info__title {
113120
font-size: 1.4rem !important;
114-
font-weight: normal;
121+
font-weight: bold;
115122
margin-top: 0;
116123
margin-bottom: 0;
117124
color: inherit;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767

6868
.pl-c-tabs__header {
6969
position: sticky;
70+
z-index: 1; // fix for Safari for iOS sticky header appearing to be below the scrollable content
7071
top: 0px;
7172
border-top: 1px solid #ddd;
7273
margin-left: calc(-0.5rem - 1px);

packages/uikit-workshop/src/sass/scss/05-themes/_light-theme.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@
4545
}
4646
}
4747

48-
/**
49-
* All Nav links inside of subnav dropdown
50-
*/
51-
52-
/**
53-
* Last sublist item
54-
*/
55-
.pl-c-nav__sublist > .pl-c-nav__item:last-child .pl-c-nav__link {
56-
@media all and (min-width: $pl-bp-med) {
57-
border-bottom-left-radius: $pl-border-radius-med;
58-
border-bottom-right-radius: $pl-border-radius-med;
59-
}
60-
}
61-
6248
/**
6349
* Size input
6450
*/

packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js

Lines changed: 18 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ class Nav extends BaseComponent {
187187
e.target.closest('pl-toggle-layout') === null
188188
) {
189189
if (this.layoutMode !== 'vertical' && window.innerWidth > 670) {
190-
console.log('handlePageClick + cleaning up...');
191190
this.cleanupActiveNav(true);
192191
}
193192
}
@@ -294,6 +293,14 @@ class Nav extends BaseComponent {
294293
this.navAccordionPanels.forEach(panel => {
295294
panel.classList.remove('pl-is-active');
296295
});
296+
} else if (this.layoutMode === 'vertical' && window.innerWidth <= 670) {
297+
this.navContainer.classList.remove('pl-is-active');
298+
this.navAccordionTriggers.forEach(trigger => {
299+
trigger.classList.remove('pl-is-active');
300+
});
301+
this.navAccordionPanels.forEach(panel => {
302+
panel.classList.remove('pl-is-active');
303+
});
297304
} else {
298305
this.navContainer.classList.remove('pl-is-active');
299306
}
@@ -326,24 +333,13 @@ class Nav extends BaseComponent {
326333
activeLink.classList.add('pl-is-active');
327334
this.previousActiveLinks.push(activeLink);
328335

329-
// handle overview links vs nested links
330-
if (activeLink.classList.contains('pl-js-link-overview')) {
331-
const childDropdownTrigger = activeLink.nextSibling;
332-
const childDropdown = activeLink.parentNode.nextSibling;
333-
334-
if (childDropdown && shouldAutoOpenNav) {
335-
if (childDropdown.tagName) {
336-
childDropdown.classList.add('pl-is-active');
337-
this.previousActiveLinks.push(childDropdown);
338-
}
339-
}
340-
341-
if (childDropdownTrigger && shouldAutoOpenNav) {
342-
if (childDropdownTrigger.tagName) {
343-
childDropdownTrigger.classList.add('pl-is-active');
344-
this.previousActiveLinks.push(childDropdownTrigger);
345-
}
346-
}
336+
if (
337+
activeLink.parentNode.classList.contains(
338+
'pl-c-nav__link--overview-wrapper'
339+
)
340+
) {
341+
activeLink.parentNode.classList.add('pl-is-active');
342+
this.previousActiveLinks.push(activeLink.parentNode);
347343
}
348344

349345
const parentDropdown = activeLink.closest('.pl-js-acc-panel');
@@ -359,8 +355,8 @@ class Nav extends BaseComponent {
359355
) &&
360356
shouldAutoOpenNav
361357
) {
362-
this.previousActiveLinks.push(parentDropdown.previousSibling);
363358
parentDropdown.previousSibling.classList.add('pl-is-active');
359+
this.previousActiveLinks.push(parentDropdown.previousSibling);
364360
parentDropdownTrigger = parentDropdown.previousSibling.querySelector(
365361
'.pl-js-acc-handle'
366362
);
@@ -372,31 +368,6 @@ class Nav extends BaseComponent {
372368
const grandparentDropdownTrigger =
373369
grandparentDropdown.previousSibling;
374370

375-
if (parentDropdown && shouldAutoOpenNav) {
376-
parentDropdown.classList.add('pl-is-active');
377-
this.previousActiveLinks.push(parentDropdown);
378-
}
379-
380-
// don't auto-open
381-
if (parentDropdownTrigger) {
382-
if (
383-
shouldAutoOpenNav === true ||
384-
parentDropdownTrigger.classList.contains(
385-
'pl-c-nav__link--title'
386-
) === false
387-
) {
388-
parentDropdownTrigger.classList.add('pl-is-active');
389-
this.previousActiveLinks.push(parentDropdownTrigger);
390-
}
391-
}
392-
393-
if (grandparentDropdown && shouldAutoOpenNav) {
394-
if (shouldAutoOpenNav) {
395-
grandparentDropdown.classList.add('pl-is-active');
396-
}
397-
this.previousActiveLinks.push(grandparentDropdown);
398-
}
399-
400371
if (grandparentDropdownTrigger && shouldAutoOpenNav) {
401372
if (shouldAutoOpenNav) {
402373
grandparentDropdownTrigger.classList.add('pl-is-active');
@@ -425,72 +396,12 @@ class Nav extends BaseComponent {
425396

426397
toggleSpecialNavPanel(e) {
427398
const target = e.target;
428-
const panel = target.parentNode.nextSibling;
429-
const subnav = panel.parentNode.parentNode.classList.contains(
430-
'pl-js-acc-panel'
431-
);
432-
433-
if (!subnav) {
434-
const navTriggers = document.querySelectorAll(
435-
`.pl-js-acc-handle.pl-is-active`
436-
);
437-
const navPanels = document.querySelectorAll(
438-
`.pl-js-acc-panel.pl-is-active`
439-
);
440-
441-
navTriggers.forEach(navTrigger => {
442-
if (navTrigger !== target) {
443-
navTrigger.classList.remove('pl-is-active');
444-
}
445-
});
446-
447-
navPanels.forEach(navPanel => {
448-
if (navPanel !== target) {
449-
navPanel.classList.remove('pl-is-active');
450-
}
451-
});
452-
}
453-
454-
if (target.classList.contains('pl-is-active')) {
455-
target.classList.remove('pl-is-active');
456-
panel.classList.remove('pl-is-active');
457-
} else {
458-
target.classList.add('pl-is-active');
459-
panel.classList.add('pl-is-active');
460-
}
399+
target.parentNode.classList.toggle('pl-is-active');
461400
}
462401

463402
toggleNavPanel(e) {
464403
const target = e.target;
465-
const panel = target.nextSibling;
466-
const subnav = target.parentNode.parentNode.classList.contains(
467-
'pl-js-acc-panel'
468-
);
469-
470-
if (!subnav) {
471-
const navTriggers = document.querySelectorAll('.pl-js-acc-handle');
472-
const navPanels = document.querySelectorAll('.pl-js-acc-panel');
473-
474-
navTriggers.forEach(navTrigger => {
475-
if (navTrigger !== target) {
476-
navTrigger.classList.remove('pl-is-active');
477-
}
478-
});
479-
480-
navPanels.forEach(navPanel => {
481-
if (navPanel !== target) {
482-
navPanel.classList.remove('pl-is-active');
483-
}
484-
});
485-
}
486-
487-
if (target.classList.contains('pl-is-active')) {
488-
target.classList.remove('pl-is-active');
489-
panel.classList.remove('pl-is-active');
490-
} else {
491-
target.classList.add('pl-is-active');
492-
panel.classList.add('pl-is-active');
493-
}
404+
target.classList.toggle('pl-is-active');
494405
}
495406

496407
rendered() {

0 commit comments

Comments
 (0)