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

selected state for product switch items #1326

Merged
merged 4 commits into from
May 14, 2020
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
8 changes: 7 additions & 1 deletion core/src/navigation/MobileTopNavDropDown.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3 class="fd-dialog__title">{label}</h3>
{#if nodes}
{#each nodes as node}
<li
class="fd-product-switch__item {noSubTitle == 'true' ? 'y-has-no-subtitle' : '' }"
class="fd-product-switch__item {noSubTitle == 'true' ? 'y-has-no-subtitle' : '' } {node.selected?'selected':''}"
on:click="{() => onActionClick(node)}"
data-e2e="mobile-topnav-item"
data-testid="{getTestId(node)}"
Expand Down Expand Up @@ -77,6 +77,12 @@ <h3 class="fd-dialog__title">{label}</h3>
</script>

<style type="text/scss">
/* TODO remove after update to fundamental 0.9 */
.fd-product-switch__item.selected .fd-product-switch__title:before,
.fd-product-switch__item.selected .fd-product-switch__title:after {
content: none !important;
}

@media (max-width: 1023px) {
.fd-product-switch__body--mobile {
.fd-product-switch__icon {
Expand Down
2 changes: 1 addition & 1 deletion core/src/navigation/ProductSwitcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{#each productSwitcherItems as productSwitcherItem}
{#if productSwitcherItem.label}
<li
class="fd-product-switch__item"
class="fd-product-switch__item {productSwitcherItem.selected?'selected':''}"
on:click="{() => onActionClick(productSwitcherItem)}"
data-testid="{getTestId(productSwitcherItem)}"
>
Expand Down
1 change: 1 addition & 0 deletions docs/navigation-parameters-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ The product switcher is a pop-up window available in the top navigation bar. It
- **icon** is the name of an icon from the [OpenUI](https://openui5.hana.ondemand.com/1.40.10/iconExplorer.html) or a custom link (relative or absolute) to an image displayed next to the label or instead of it.
- **altText** adds the HTML `alt` attribute to an icon. Note that this property only applies to icons with a defined absolute or relative path.
- **link** defines an absolute link to a **node**.
- **selected** if set to true, the item is displayed in selected state, useful e.g. if the item refers to the current product.
- **externalLink** is an object which indicates that the node links to an external URL. If this parameter
is defined, the **link** parameter
is ignored. It has the following attributes:
Expand Down