Skip to content

Commit

Permalink
fix(#1286): Removed grey border from top of AppHeader links
Browse files Browse the repository at this point in the history
  • Loading branch information
ArakTaiRoth committed Nov 24, 2023
1 parent 261217b commit 386d1c9
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions libs/web-components/src/components/app-header/AppHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let _windowWidth = window.innerWidth;
let _showToggleMenu = false;
let _showMenu = false;
// Reactive
$: _mobile = _windowWidth < MOBILE_BP;
Expand All @@ -36,7 +36,7 @@
const hideMenu = () => _showMenu = false;
// Hooks
onMount(() => {
window.addEventListener("popstate", () => {
// only hide menu for non-desktop screens
Expand All @@ -52,10 +52,10 @@
// Update component if the current browser url matches one of this element's child links
function setCurrentLink() {
if (!_slotParentEl) return;
const slot = _slotParentEl.querySelector("slot") as HTMLSlotElement;
if (!slot) return;
const link = slot.assignedElements()
.filter(el => el.tagName === "A")
.map(el => {
Expand All @@ -74,7 +74,7 @@
// *Menu* children count
// When in mobile mode, while the children are not visible the children are rendered in a div[display: none]
// element to allow for the children count to be obtained.
// element to allow for the children count to be obtained.
async function hasChildren() {
await tick();
Expand All @@ -87,8 +87,8 @@
} else {
// testing
return [..._slotParentEl.querySelectorAll("a")].length > 0
}
}
}
}
</script>

<!-- HTML -->
Expand Down Expand Up @@ -122,15 +122,15 @@
{#if _showToggleMenu && _mobile}
<button on:click={toggleMenu} class="menu-toggle-area" data-testid="menu-toggle">
Menu <goa-icon type={_showMenu ? "chevron-up" : "chevron-down" } mt="1" />
</button>
</button>
{/if}

<!-- Menu and menu button for tablet -->
{#if _showToggleMenu && _tablet}
<goa-popover
class="menu"
open={_showMenu}
context="app-header-menu"
class="menu"
open={_showMenu}
context="app-header-menu"
focusborderwidth="0"
borderradius="0"
padded="false"
Expand All @@ -142,19 +142,19 @@
<div slot="target">
<button on:click={toggleMenu} class="menu-toggle-area" data-testid="menu-toggle">
Menu <goa-icon type={_showMenu ? "chevron-up" : "chevron-down" } mt="1" />
</button>
</button>
</div>

{#if _showMenu}
<div bind:this={_slotParentEl} data-testid="slot">
<slot />
<slot />
</div>
{/if}
</goa-popover>
{/if}

<!--
Need to render slot content to allow mobile and tablet views to
<!--
Need to render slot content to allow mobile and tablet views to
know whether or not to show the Menu button. `_slotContainer` provides
a reference to determine if any slot children exist.
-->
Expand Down Expand Up @@ -204,7 +204,7 @@
display: grid;
grid-template-columns: 1fr auto;
grid-template-rows: 3.375rem auto;
grid-template-areas:
grid-template-areas:
"header menu"
"links links";
}
Expand Down Expand Up @@ -266,9 +266,8 @@
display: block;
padding: calc((3rem - var(--goa-line-height-3)) / 2) 1rem;
text-decoration: none;
cursor: pointer;
cursor: pointer;
white-space: nowrap;
box-shadow: inset 0 var(--goa-border-width-s) 0 0 var(--goa-color-greyscale-200);
}
::slotted(a:hover) {
background-color: var(--goa-color-greyscale-100);
Expand All @@ -293,12 +292,15 @@
.show-menu {
border-bottom: var(--goa-border-width-m) solid var(--goa-color-greyscale-200);
}
::slotted(a) {
box-shadow: inset 0 var(--goa-border-width-s) 0 0 var(--goa-color-greyscale-200);
}
}
@media not (--mobile) {
*, ::slotted(*) {
font: var(--goa-typography-body-m);
}
}
.layout {
grid-template-rows: 4rem auto;
}
Expand All @@ -320,9 +322,12 @@
.image-mobile {
display: none;
}
::slotted(a) {
box-shadow: inset 0 var(--goa-border-width-s) 0 0 var(--goa-color-greyscale-200);
}
}
@media (--desktop) {
@media (--desktop) {
.image-desktop {
display: block;
}
Expand All @@ -338,7 +343,7 @@
margin: 0 auto;
width: min(var(--max-content-width), 100%);
}
.header-logo-title-area {
grid-area: header;
display: flex;
Expand All @@ -353,7 +358,7 @@
display: flex;
align-items: stretch;
}
::slotted(goa-app-header-menu),
::slotted(a),
::slotted(a:visited) {
Expand Down

0 comments on commit 386d1c9

Please sign in to comment.