Skip to content

Commit

Permalink
Merge 8105289 into d1344d3
Browse files Browse the repository at this point in the history
  • Loading branch information
sghoweri committed Sep 5, 2019
2 parents d1344d3 + 8105289 commit 6862c8a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

27 changes: 17 additions & 10 deletions packages/uikit-workshop/src/scripts/components/pl-nav/pl-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,23 @@ class Nav extends BaseComponent {
);
})}

{/* <li class="pl-c-nav__item">
<a
href="styleguide/html/styleguide.html"
class="pl-c-nav__link pl-c-nav__link--pattern"
data-patternpartial="all"
tabindex="0"
>
All
</a>
</li> */}
{/* 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 */}
{(window.ishControls === undefined ||
window.ishControls.ishControlsHide === undefined ||
(window.ishControls.ishControlsHide['views-all'] !== true &&
window.ishControls.ishControlsHide.all !== true)) && (
<li class="pl-c-nav__item">
<a
onClick={e => this.handleClick(e, 'all')}
href="styleguide/html/styleguide.html"
class="pl-c-nav__link pl-c-nav__link--pattern"
data-patternpartial="all"
tabindex="0"
>
All
</a>
</li>
)}
</ol>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ class IFrame extends BaseComponent {

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

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

if (currentPattern) {
document.title = 'Pattern Lab - ' + currentPattern;

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

// first time hitting a PL page -- no query string on the current page
if (patternParam === null) {
window.history.replaceState(
{
currentPattern: e.detail.pattern,
currentPattern: currentPattern,
},
null,
addressReplacement
);
} else {
window.history.replaceState(
{
currentPattern: e.detail.pattern,
currentPattern: currentPattern,
},
null,
addressReplacement
Expand Down Expand Up @@ -348,7 +351,10 @@ class IFrame extends BaseComponent {
if (window.patternData) {
patternParam = window.patternData.patternPartial;
} else {
patternParam = 'all'; // @todo: this should also be able to be dynamically set via PL config file
patternParam =
window.config && window.config.defaultPattern
? window.config.defaultPattern
: 'all';
}
}

Expand Down

0 comments on commit 6862c8a

Please sign in to comment.