Skip to content

Commit

Permalink
[OUR415-281] Refactors mobile menu with new design (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosschapman authored Sep 30, 2024
1 parent 85ae285 commit f549ec9
Show file tree
Hide file tree
Showing 21 changed files with 311 additions and 467 deletions.
6 changes: 4 additions & 2 deletions app/components/search/SearchResults/SearchResults.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
z-index: 2;
background: #fff;
transition: top 200ms ease-in-out;
&.mobileMapIsCollapsed {
top: calc(-50vh + 20px);

// Sets height from top of the viewport on mobile
&.resultsPositionWhenMapCollapsed {
top: calc(-50vh + 10px);
z-index: 1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/search/SearchResults/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const SearchResults = ({
<div className={styles.searchResultsAndMapContainer}>
<div
className={`${styles.searchResultsContainer} ${
mobileMapIsCollapsed ? styles.mobileMapIsCollapsed : ""
mobileMapIsCollapsed ? styles.resultsPositionWhenMapCollapsed : ""
}`}
>
<h2 className="sr-only">Search results</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
border-radius: $rounded-lg;
border: 2px solid $secondary-button-outline;

@media screen and (min-width: $min-tablet-p) {
@media screen and (min-width: $break-tablet-s) {
display: none;
}

Expand Down
1 change: 0 additions & 1 deletion app/components/search/Sidebar/Sidebar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
height: auto;
width: 100%;
padding: 0;
z-index: $z-index-modal;
align-self: flex-start;
border-right: 0;
background-color: #fff;
Expand Down
47 changes: 0 additions & 47 deletions app/components/ui/ClientHandoutsModal/ClientHandouts.module.scss

This file was deleted.

44 changes: 0 additions & 44 deletions app/components/ui/Modal/Modal.module.scss

This file was deleted.

78 changes: 64 additions & 14 deletions app/components/ui/Navigation/MobileNavigation.module.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
@import "../../../styles/utils/_helpers.scss";
@import "../../../styles/utils/_colors.scss";

.sidebar {
@media screen and (min-width: $break-tablet-s) {
display: none;
}
.mobileNavigationContainer {
position: absolute;
border-top: 1px solid $gray-300;
border-bottom: 1px solid $gray-300;
right: $spacing-6;
top: $header-height;
background: $white;
width: 400px;
}

.menuActivator {
display: none;
}

.mobileNavigationMenuContainer {
Expand Down Expand Up @@ -57,6 +65,26 @@
}
}

.mobileNavigationMenuBack {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: $spacing-3 $spacing-4;
font-size: 16px;
border-bottom: 1px solid #d1d5db;
background: $color-grey1;

&:focus {
border-radius: 0;
margin: 3px;
}

.chevron {
font-size: 14px;
}
}

// Should not be the same class for both single level and dropdown item
.mobileNavigationMenuLink {
// flex ensures each menu link fills width of widest item
Expand All @@ -83,18 +111,20 @@
overflow: hidden;
top: 0;
border-radius: 0;
transition: transform 0.5s ease;
width: 100%;
transform: translateX(100%);
background: $white;
visibility: hidden;
}

.mobileNavigationMenuListOpen {
transform: translateX(0);
.mobileNavigationMenuHeader:has(+ .mobileNavigationMenuListOpen),
.mobileNavigationMenuListOpen + {
visibility: hidden;
display: none;
}

// Fills out entire sidebar
.mobileNavigationMenuListOpen {
visibility: visible;
width: 100%;
height: 100%;
}

.mobileTopLevelNavigationMenuItem {
Expand All @@ -105,8 +135,28 @@

.mobileNavigationMenuTranslate {
padding: $general-spacing-md;
position: absolute;
bottom: 0px;
// Keeps on top of active submenu
z-index: $z-index-top;
}

.activatePushPanelButton {
font-size: 18px !important;
font-family: Montserrat;
font-weight: 500;
}

// Less than desktop
@include r_max($break-desktop-s) {
.menuActivator {
display: flex;
align-items: center;
}
.mobileNavigationContainer {
top: $header-mobile-height;
}
}

// Less than tablet
@include r_max($break-tablet-s) {
.mobileNavigationContainer {
top: $header-mobile-height;
}
}
12 changes: 1 addition & 11 deletions app/components/ui/Navigation/MobileNavigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ import { MobileNavigation } from "components/ui/Navigation/MobileNavigation";

describe("<MobileNavigation />", () => {
it("checks a valid user should render the appropriate fields in the right place", () => {
render(
<MobileNavigation
isOpen
setSubMenu={() => {
return;
}}
activeSubMenu=""
menuData={[]}
/>,
{ wrapper: BrowserRouter }
);
render(<MobileNavigation menuData={[]} />, { wrapper: BrowserRouter });
});
});
Loading

0 comments on commit f549ec9

Please sign in to comment.