| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -572,16 +572,23 @@ class Nav extends BaseComponent { | |||
| 572 | 572 | ); | |
| 573 | 573 | })} | |
| 574 | 574 | ||
| 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 | + )} | ||
| 585 | 592 | </ol> | |
| 586 | 593 | ); | |
| 587 | 594 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,12 +53,15 @@ class IFrame extends BaseComponent { | |||
| 53 | 53 | ||
| 54 | 54 | // update the currently active nav + add / update the page's query string | |
| 55 | 55 | handlePageLoad(e) { | |
| 56 | - var queryString = window.location.search; | ||
| 56 | + const queryString = window.location.search; | ||
| 57 | 57 | const urlParams = new URLSearchParams(queryString); | |
| 58 | - let patternParam = urlParams.get('p'); | ||
| 58 | + const patternParam = urlParams.get('p'); | ||
| 59 | 59 | ||
| 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; | ||
| 62 | 65 | ||
| 63 | 66 | const addressReplacement = | |
| 64 | 67 | window.location.protocol === 'file:' | |
@@ -68,21 +71,21 @@ class IFrame extends BaseComponent { | |||
| 68 | 71 | window.location.host + | |
| 69 | 72 | window.location.pathname.replace('index.html', '') + | |
| 70 | 73 | '?p=' + | |
| 71 | - e.detail.pattern; | ||
| 74 | + currentPattern; | ||
| 72 | 75 | ||
| 73 | 76 | // first time hitting a PL page -- no query string on the current page | |
| 74 | 77 | if (patternParam === null) { | |
| 75 | 78 | window.history.replaceState( | |
| 76 | 79 | { | |
| 77 | - currentPattern: e.detail.pattern, | ||
| 80 | + currentPattern: currentPattern, | ||
| 78 | 81 | }, | |
| 79 | 82 | null, | |
| 80 | 83 | addressReplacement | |
| 81 | 84 | ); | |
| 82 | 85 | } else { | |
| 83 | 86 | window.history.replaceState( | |
| 84 | 87 | { | |
| 85 | - currentPattern: e.detail.pattern, | ||
| 88 | + currentPattern: currentPattern, | ||
| 86 | 89 | }, | |
| 87 | 90 | null, | |
| 88 | 91 | addressReplacement | |
@@ -348,7 +351,10 @@ class IFrame extends BaseComponent { | |||
| 348 | 351 | if (window.patternData) { | |
| 349 | 352 | patternParam = window.patternData.patternPartial; | |
| 350 | 353 | } 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'; | ||
| 352 | 358 | } | |
| 353 | 359 | } | |
| 354 | 360 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments