Skip to content

Commit f76bdeb

Browse files
committed
Merge branch 'dev' of https://github.com/pattern-lab/patternlab-node into dev
2 parents b4c20ef + c933b11 commit f76bdeb

File tree

8 files changed

+35
-22
lines changed

8 files changed

+35
-22
lines changed

packages/uikit-workshop/dist/styleguide/js/patternlab-pattern.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/patternlab-viewer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/pl-modal-viewer-chunk-3fe28fc15af5f6e6de20.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/pl-modal-viewer-chunk-9bbdeb5a6429fb975bf6.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/uikit-workshop/dist/styleguide/js/vendors-chunk-368ce70a44a769eb1657.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uikit-workshop/dist/styleguide/js/vendors-chunk-9464cbd6da08f5397b83.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,23 @@ class Nav extends BaseComponent {
572572
);
573573
})}
574574

575-
{/* <li class="pl-c-nav__item">
576-
<a
577-
href="styleguide/html/styleguide.html"
578-
class="pl-c-nav__link pl-c-nav__link--pattern"
579-
data-patternpartial="all"
580-
tabindex="0"
581-
>
582-
All
583-
</a>
584-
</li> */}
575+
{/* display the All link if window.ishControlsHide is undefined (for some reason) OR window.ishControls.ishControlsHide doesn't have `views-all` and/or `all` set to true */}
576+
{(window.ishControls === undefined ||
577+
window.ishControls.ishControlsHide === undefined ||
578+
(window.ishControls.ishControlsHide['views-all'] !== true &&
579+
window.ishControls.ishControlsHide.all !== true)) && (
580+
<li class="pl-c-nav__item">
581+
<a
582+
onClick={e => this.handleClick(e, 'all')}
583+
href="styleguide/html/styleguide.html"
584+
class="pl-c-nav__link pl-c-nav__link--pattern"
585+
data-patternpartial="all"
586+
tabindex="0"
587+
>
588+
All
589+
</a>
590+
</li>
591+
)}
585592
</ol>
586593
);
587594
}

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ class IFrame extends BaseComponent {
5353

5454
// update the currently active nav + add / update the page's query string
5555
handlePageLoad(e) {
56-
var queryString = window.location.search;
56+
const queryString = window.location.search;
5757
const urlParams = new URLSearchParams(queryString);
58-
let patternParam = urlParams.get('p');
58+
const patternParam = urlParams.get('p');
5959

60-
if (e.detail.pattern) {
61-
document.title = 'Pattern Lab - ' + e.detail.pattern;
60+
const currentPattern =
61+
e.detail.pattern || window.config.defaultPattern || 'all';
62+
63+
if (currentPattern) {
64+
document.title = 'Pattern Lab - ' + currentPattern;
6265

6366
const addressReplacement =
6467
window.location.protocol === 'file:'
@@ -68,21 +71,21 @@ class IFrame extends BaseComponent {
6871
window.location.host +
6972
window.location.pathname.replace('index.html', '') +
7073
'?p=' +
71-
e.detail.pattern;
74+
currentPattern;
7275

7376
// first time hitting a PL page -- no query string on the current page
7477
if (patternParam === null) {
7578
window.history.replaceState(
7679
{
77-
currentPattern: e.detail.pattern,
80+
currentPattern: currentPattern,
7881
},
7982
null,
8083
addressReplacement
8184
);
8285
} else {
8386
window.history.replaceState(
8487
{
85-
currentPattern: e.detail.pattern,
88+
currentPattern: currentPattern,
8689
},
8790
null,
8891
addressReplacement
@@ -348,7 +351,10 @@ class IFrame extends BaseComponent {
348351
if (window.patternData) {
349352
patternParam = window.patternData.patternPartial;
350353
} else {
351-
patternParam = 'all'; // @todo: this should also be able to be dynamically set via PL config file
354+
patternParam =
355+
window.config && window.config.defaultPattern
356+
? window.config.defaultPattern
357+
: 'all';
352358
}
353359
}
354360

0 commit comments

Comments
 (0)