Skip to content

Commit

Permalink
feat(style) - add dark overlay to navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shashika6 committed Oct 2, 2024
1 parent 248f7b4 commit fe9cca6
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 30 deletions.
7 changes: 7 additions & 0 deletions .changeset/cyan-goats-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ilo-org/react": patch
"@ilo-org/twig": patch
"@ilo-org/styles": patch
---

Add a dark overlay when search button is clicked in the navigation component
22 changes: 11 additions & 11 deletions packages/react/src/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,17 @@ const Navigation: FC<NavigationProps> = ({
</div>
</nav>
)}
<div
style={{ display: searchTabbable ? "block" : "none" }}
className={`${prefix}--search-box`}
>
<div className={`${prefix}--header--inner ${prefix}--container`}>
<SearchField
input={searchfield?.input}
action={searchfield?.action}
ref={searchInputRef}
></SearchField>
</div>
</div>
<div
style={{ display: searchTabbable ? "block" : "none" }}
className={`${prefix}--search-box`}
>
<div className={`${prefix}--header--inner ${prefix}--container`}>
<SearchField
input={searchfield?.input}
action={searchfield?.action}
ref={searchInputRef}
></SearchField>
</div>
</div>
</header>
Expand Down
33 changes: 32 additions & 1 deletion packages/styles/scss/components/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
position: relative;
z-index: 4;

&::after {
content: "";
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
background-color: var(--ilo-color-blue-dark-ramp);
visibility: hidden;
transition:
opacity 225ms ease-out,
visibility 0s 225ms;
z-index: 500;
}

&.ilo--search--open {
&::after {
opacity: 1;
visibility: visible;
transition: opacity 225ms ease-out;
}
}

&.ilo--mobile--open {
height: 100%;
left: 0;
Expand Down Expand Up @@ -114,13 +138,18 @@
}

@include breakpoint("lg") {
position: relative;
z-index: 999;
background: $brand-ilo-blue;
}
}

&--utility-bar {
display: none;
min-height: px-to-rem(24px);
position: relative;
z-index: 999;

&--local {
background: $brand-ilo-blue;
display: flex;
Expand Down Expand Up @@ -230,6 +259,7 @@
visibility 225ms 0ms;
width: 100%;
visibility: hidden;
z-index: 999;

.ilo--header.ilo--mobile--open & {
transform: translateX(0);
Expand All @@ -245,7 +275,7 @@
@include breakpoint("lg") {
background: $brand-ilo-dark-blue;
overflow: visible;
position: static;
position: relative;
transform: none;
visibility: visible;
}
Expand Down Expand Up @@ -864,6 +894,7 @@
.ilo--search--open & {
visibility: visible;
transform: translateX(0);
z-index: 999;
}

@include breakpoint("lg") {
Expand Down
35 changes: 17 additions & 18 deletions packages/twig/src/components/navigation/navigation.twig
Original file line number Diff line number Diff line change
Expand Up @@ -142,30 +142,29 @@
<!-- /.{{prefix}}--subnav--inner -->
</nav>
{% endif %}

</div>
<!-- /.{{prefix}}--header--navigation -->
<div class="{{prefix}}--search-box">
<div class="{{prefix}}--header--inner {{ prefix }}--container">
{% block desktopSearch %}
{% include '@components/form/form.twig' with {
attributes: {
action: searchfield.action,
"aria-label": label,
"data-search": "true",
},
fieldsets: [{
fields: [{
type: "search",
placeholder: searchfield.input.placeholder,
name: searchfield.input.name,
id: searchfield.input.id,
}]
}]
}
%}
attributes: {
action: searchfield.action,
"aria-label": label,
"data-search": "true",
},
fieldsets: [{
fields: [{
type: "search",
placeholder: searchfield.input.placeholder,
name: searchfield.input.name,
id: searchfield.input.id,
}]
}]
}
%}
{% endblock %}
</div>
</div>
<!-- /.{{prefix}}--search-box -->
</div>
<!-- /.{{prefix}}--header--navigation -->
</header>

0 comments on commit fe9cca6

Please sign in to comment.