Skip to content

Commit a199f22

Browse files
committed
refactor(secnav): implement feedback
* fix topnav user menu chevron
1 parent 8312104 commit a199f22

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

docs/components/secnav/test.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
<nav id="hxSecNav">
8585
<a href="#" class="hxNavLink">SecNav One</a>
8686
<hx-disclosure aria-controls="secnav-option-menu">
87-
<span>SecNav Two</span><hx-icon class="hxPrimary" type="angle-down"></hx-icon>
87+
<span>SecNav Two</span>
88+
<hx-icon class="hxPrimary" type="angle-down"></hx-icon>
8889
</hx-disclosure>
8990
<hx-menu id="secnav-option-menu">
9091
<section>
@@ -95,7 +96,8 @@
9596
</section>
9697
</hx-menu>
9798
<hx-disclosure aria-controls="secnav-option-menu-two">
98-
<span>SecNav Three</span><hx-icon class="hxPrimary" type="angle-down"></hx-icon>
99+
<span>SecNav Three</span>
100+
<hx-icon class="hxPrimary" type="angle-down"></hx-icon>
99101
</hx-disclosure>
100102
<hx-menu id="secnav-option-menu-two">
101103
<section>
@@ -121,7 +123,8 @@
121123
</section>
122124
</hx-menu>
123125
<hx-disclosure aria-controls="secnav-option-menu-three">
124-
<span>SecNav Four</span><hx-icon class="hxPrimary" type="angle-down"></hx-icon>
126+
<span>SecNav Four</span>
127+
<hx-icon class="hxPrimary" type="angle-down"></hx-icon>
125128
</hx-disclosure>
126129
<hx-menu class = "hxSecNavTwoColMenu" id="secnav-option-menu-three">
127130
<section class="hxLeftColMenu">

src/scss/components/secnav/index.scss

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/// * =================================== * ///
88

99
#hxSecNav {
10+
display: flex; // prevent browser injected whitespace
1011
background-color: $gray-0;
1112
background-color: var(--hxSecNav-bgcolor, $gray-0);
1213
border-bottom: 0.125rem solid $gray-300;
@@ -19,7 +20,6 @@
1920
> hx-disclosure {
2021
color: $gray-950;
2122
color: var(--hxSecNav-hxNavLink-color, $gray-950);
22-
display: inline-block;
2323
font-size: 1rem;
2424
height: 3.75rem;
2525
padding: 1.25rem;
@@ -31,7 +31,8 @@
3131
color: $purple-500 !important;
3232
color: var(--hxSecNav-hxDisclosure-hover-color, $purple-500) !important;
3333

34-
> hx-icon, > span {
34+
> hx-icon,
35+
> span {
3536
color: $purple-500 !important;
3637
color: var(--hxSecNav-hxDisclosure-hover-color, $purple-500) !important;
3738
}
@@ -41,6 +42,19 @@
4142
color: $gray-0;
4243
color: var(--hxSecNav-hxNavLink-active-color, $gray-0);
4344
}
45+
46+
.hxPrimary { // override Reveal component defaults
47+
font-size: 0.75em;
48+
pointer-events: none;
49+
transform: translateY(-50%);
50+
}
51+
52+
&[aria-expanded="true"] {
53+
.hxPrimary {
54+
font-size: 0.75em;
55+
transform: translateY(-50%) scaleY(-1);
56+
}
57+
}
4458
}
4559

4660
.hxNavLink {
@@ -49,13 +63,14 @@
4963

5064
> hx-disclosure {
5165
margin-right: -0.25rem;
66+
display: flex; // prevent browser injected whitespace
5267

5368
> hx-icon {
5469
color: $gray-600;
5570
color: var(--hxSecNav-hxDisclosure-hxIcon-color, $gray-600);
5671
font-size: 1rem;
5772
margin-left: 0.5rem;
58-
margin-top: 0.25rem;
73+
margin-top: 0.813rem; // 13px
5974
width: 0.75rem;
6075
}
6176

@@ -71,9 +86,10 @@
7186
}
7287

7388
&[aria-expanded="true"] {
74-
> hx-icon, > span {
89+
> hx-icon > span {
7590
color: $purple-500;
7691
color: var(--hxSecNav-hxDisclosure-aria-expanded-color, $purple-500);
92+
transform: translateY(50%) scaleY(-1);
7793
}
7894
}
7995
}

src/scss/components/topnav/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
> hx-disclosure {
6060
border-bottom: 2px solid $purple-500;
6161
border-bottom: 2px solid var(--hxTopNav-hxTopNavOptionMenu-borderbottom, $purple-500);
62+
font-size: 0; // remove browser injected whitespace
6263
height: 3.8rem;
6364
padding: 0.625rem 1.25rem 0;
6465
width: auto;
@@ -87,7 +88,6 @@
8788

8889
hx-icon {
8990
font-size: 0.938rem;
90-
height: 1.375rem;
9191
margin: 0.688rem 0 0.313rem;
9292
width: 1.25rem;
9393
}
@@ -120,6 +120,7 @@
120120
#topnav-menu, // deprecated
121121
#topnav-productMenu, // deprecated
122122
.hxTopNavMenu > hx-disclosure {
123+
font-size: 0;
123124
height: 3.8rem;
124125
outline: none;
125126
padding: 1.3rem 1.25rem 1.12rem 1rem;

0 commit comments

Comments
 (0)