Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taruntds's "Added "activePage" as a active class in navigation menu and web pages" #1354

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fix carousel dots overlapping thumbnails on Product page. [#1351](https://github.com/bigcommerce/cornerstone/pull/1351)
- Cornerstone schema updates and organization [#1350](https://github.com/bigcommerce/cornerstone/pull/1350)
- Add div and id attributes so that contact form steps can be tracked [#1317](https://github.com/bigcommerce/cornerstone/pull/1317)
- Added "activePage" as a active class in navigation menus and web pages. [#1354](https://github.com/bigcommerce/cornerstone/pull/1354)

## 2.4.0 (2018-09-14)
- Fix encoding issues on Account Signup Form ("'" characters showing in country name)[#1341] (https://github.com/bigcommerce/cornerstone/pull/1341)
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/components/stencil/navPages/_navPages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
}
}

&:hover {
&:hover, &.activePage {
color: stencilColor("navPages-color-hover");

// scss-lint:disable NestingDepth
Expand Down
4 changes: 2 additions & 2 deletions templates/components/common/navigation-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
{{#each children}}
<li class="navPage-subMenu-item-child">
{{#if children}}
<a class="navPage-subMenu-action navPages-action navPages-action-depth-max has-subMenu" href="{{url}}" data-collapsible="navPages-{{id}}">
<a class="navPage-subMenu-action navPages-action navPages-action-depth-max has-subMenu{{#if is_active}} activePage{{/if}}" href="{{url}}" data-collapsible="navPages-{{id}}">
{{name}} <i class="icon navPages-action-moreIcon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down" /></svg></i>
</a>
{{> components/common/navigation-dropdown}}
{{else}}
<a class="navPage-subMenu-action navPages-action" href="{{url}}">{{name}}</a>
<a class="navPage-subMenu-action navPages-action{{#if is_active}} activePage{{/if}}" href="{{url}}">{{name}}</a>
{{/if}}
</li>
{{/each}}
Expand Down
4 changes: 2 additions & 2 deletions templates/components/common/navigation-list-alternate.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{#if children}}
<a class="navPages-action navPages-action-depth-max has-subMenu is-root" href="{{url}}" data-collapsible="navPages-{{id}}">
<a class="navPages-action navPages-action-depth-max has-subMenu is-root{{#if is_active}} activePage{{/if}}" href="{{url}}" data-collapsible="navPages-{{id}}">
{{name}} <i class="icon navPages-action-moreIcon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down" /></svg></i>
</a>
{{> components/common/navigation-dropdown}}
{{else}}
<a class="navPages-action" href="{{url}}">{{name}}</a>
<a class="navPages-action{{#if is_active}} activePage{{/if}}" href="{{url}}">{{name}}</a>
{{/if}}
10 changes: 5 additions & 5 deletions templates/components/common/navigation-list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if children}}
<a class="navPages-action has-subMenu" href="{{url}}" data-collapsible="navPages-{{id}}">
<a class="navPages-action has-subMenu{{#if is_active}} activePage{{/if}}" href="{{url}}" data-collapsible="navPages-{{id}}">
{{name}} <i class="icon navPages-action-moreIcon" aria-hidden="true"><svg><use xlink:href="#icon-chevron-down" /></svg></i>
</a>
<div class="navPage-subMenu" id="navPages-{{id}}" aria-hidden="true" tabindex="-1">
Expand All @@ -11,7 +11,7 @@
<li class="navPage-subMenu-item">
{{#if children}}
<a
class="navPage-subMenu-action navPages-action has-subMenu"
class="navPage-subMenu-action navPages-action has-subMenu{{#if is_active}} activePage{{/if}}"
href="{{url}}"
data-collapsible="navPages-{{id}}"
data-collapsible-disabled-breakpoint="medium"
Expand All @@ -22,17 +22,17 @@
<ul class="navPage-childList" id="navPages-{{id}}">
{{#each children}}
<li class="navPage-childList-item">
<a class="navPage-childList-action navPages-action" href="{{url}}">{{name}}</a>
<a class="navPage-childList-action navPages-action{{#if is_active}} activePage{{/if}}" href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
{{else}}
<a class="navPage-subMenu-action navPages-action" href="{{url}}">{{name}}</a>
<a class="navPage-subMenu-action navPages-action{{#if is_active}} activePage{{/if}}" href="{{url}}">{{name}}</a>
{{/if}}
</li>
{{/each}}
</ul>
</div>
{{else}}
<a class="navPages-action" href="{{url}}">{{name}}</a>
<a class="navPages-action{{#if is_active}} activePage{{/if}}" href="{{url}}">{{name}}</a>
{{/if}}
2 changes: 1 addition & 1 deletion templates/components/common/navigation-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{#unless theme_settings.hide_content_navigation}}
{{#each pages}}
<li class="navPages-item navPages-item-page">
<a class="navPages-action" href="{{url}}">{{name}}</a>
<a class="navPages-action{{#if name '==' ../page.title}} activePage{{/if}}" href="{{url}}">{{name}}</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this check ?

Copy link
Contributor Author

@Ubersmake Ubersmake Sep 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the parent-page scenario. If a page is nested in a tree this will highlight both the current page and its parent, like in: https://user-images.githubusercontent.com/1546172/45905025-c491ab80-bda3-11e8-8302-fab27866a954.png , where the page is "Bath" but "Bath" is in the "Shop All" category.

</li>
{{/each}}
{{/unless}}
Expand Down