Skip to content

Commit

Permalink
chore(gh-pages): code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fshovchko committed Sep 28, 2023
1 parent 0787435 commit 41e552d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pages/src/route/route-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ESLDemoRouteLink extends ESLMixinElement {

@attr() public href: string;

@boolAttr() public sublink: boolean;
@boolAttr() public relatedLink: boolean;

@prop() public activeSelector: string = '::parent';
@prop() public activeCls: string = 'active';
Expand All @@ -24,7 +24,7 @@ export class ESLDemoRouteLink extends ESLMixinElement {
protected _onPushState(): void {
const linkURL = new URL(toAbsoluteUrl(this.href || ''));

const match = this.sublink ?
const match = this.relatedLink ?
location.pathname === linkURL.pathname :
location.pathname.includes(linkURL.pathname);

Expand Down
5 changes: 3 additions & 2 deletions pages/views/_includes/navigation/sidebar-item.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
{% set isPrimaryActive = functions.isActivePath(page.url, collection) %}
{% set items = collections[collection] | released %}
{% set isDraftCollection = collection == 'draft' %}
{% set headingURL = ('/' + collection + '/') | url %}

{% if items.length %}
<div class="sidebar-nav-item-heading {{ 'active' if isPrimaryActive }}">
<a esl-d-route-link class="sidebar-nav-item-link icon-link" href="{{ ('/' + collection + '/') | url }}"
<a esl-d-route-link class="sidebar-nav-item-link icon-link" href="{{ headingURL }}"
aria-label="{{ title }} home page">
{% include icon %}
</a>
Expand Down Expand Up @@ -40,7 +41,7 @@
{% if isActive %}aria-selected="true"{% endif %}>
<a esl-d-route-link class="sidebar-nav-secondary-link"
{% if isActive %}aria-current="page"{% endif %}
sublink
{% if item.url === headingURL %}related-link{% endif %}
href="{{ item.url | url }}">
{% if isNew %}
<sup class="badge badge-sup badge-success badge-sidebar">new</sup>
Expand Down

0 comments on commit 41e552d

Please sign in to comment.