Skip to content

Commit b64575d

Browse files
Merge pull request #115 from topcoder-platform/PROD-3511_fix-hover-for-megamenu
PROD-3511 - add active & hover state for the "mega menu" -> dev
2 parents c34eea3 + bcacab2 commit b64575d

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

src/lib/components/LinksMenu.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
content: "";
1313
display: block;
1414
position: absolute;
15-
top: -18px;
15+
top: -12px;
1616
bottom: -18px;
1717
left: -16px;
1818
right: -16px;

src/lib/marketing-navigation/MarketingNavigation.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
{#if !$isMobile}
5151
{#if primaryRoute?.children?.length}
5252
<NavigationBar
53+
activeRoutePath={activeRoute}
5354
activeRoute={secondaryRoute}
5455
style='secondary'
5556
menuItems={primaryRoute.children}
@@ -58,6 +59,7 @@
5859

5960
{#if secondaryRoute?.children?.length}
6061
<NavigationBar
62+
activeRoutePath={activeRoute}
6163
activeRoute={tertiaryRoute}
6264
style='tertiary'
6365
menuItems={secondaryRoute.children}

src/lib/marketing-navigation/components/HoverMenu.module.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ a.menuSectionHeading {
8383
line-height: 22px;
8484
font-weight: 700;
8585
cursor: pointer;
86+
&:hover {
87+
color: #2A2A2A;
88+
}
89+
&:global(.active), &:active {
90+
color: #0D664E;
91+
}
8692
}
8793

8894
.menuSectionDesc {
@@ -100,6 +106,12 @@ a.menuSectionChild {
100106
font-weight: 500;
101107
color: #767676;
102108
cursor: pointer;
109+
&:hover {
110+
color: #2A2A2A;
111+
}
112+
&:global(.active), &:active {
113+
color: #0D664E;
114+
}
103115
}
104116

105117
a.ctaButton {

src/lib/marketing-navigation/components/HoverMenu.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
export let mainDescription = '';
77
export let menuItems: NavMenuItem[] = [];
88
export let isHovering: boolean = false;
9+
export let activeRoute: NavMenuItem = undefined;
910
1011
let elWrap: HTMLElement | undefined;
1112
@@ -40,6 +41,7 @@
4041
{#if !!menuItem.label}
4142
<a
4243
class={styles.menuSectionHeading}
44+
class:active={activeRoute?.url === menuItem.url}
4345
target="_top"
4446
href={menuItem.url}
4547
>
@@ -56,6 +58,7 @@
5658
<li>
5759
<a
5860
class={styles.menuSectionChild}
61+
class:active={activeRoute?.url === child.url}
5962
target="_top"
6063
href={child.url}
6164
>{child.label}</a>

src/lib/marketing-navigation/components/NavigationBar.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
>
3434
{#if !activeRoute}
3535
<HoverMenu
36+
activeRoute={activeRoutePath[3] ?? activeRoutePath[2]}
3637
menuItems={hoveredMenuItem?.children}
3738
mainDescription={hoveredMenuItem?.description}
3839
bind:isHovering={popupIsVisible}

0 commit comments

Comments
 (0)