diff --git a/assets/css/_ladder_page.scss b/assets/css/_ladder_page.scss index 756076fac..b94856a38 100644 --- a/assets/css/_ladder_page.scss +++ b/assets/css/_ladder_page.scss @@ -17,13 +17,13 @@ $color-route-tabs-separator: #9fa2ac; padding-left: $route-picker-width; } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .c-ladder-page--picker-container-visible { padding-left: $mobile-route-picker-width; } } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .c-ladder-page--picker-container-visible { .c-ladder-page__tab-bar-and-ladders { @include blur; diff --git a/assets/css/_late_view.scss b/assets/css/_late_view.scss index b3737156b..b22867264 100644 --- a/assets/css/_late_view.scss +++ b/assets/css/_late_view.scss @@ -10,8 +10,8 @@ $late-view-background-color: $color-bg-light; top: 0; z-index: map-get($z-page-layout-context, "view"); - @media screen and (max-width: 700px) { - width: 100%; + @media screen and (max-width: map-get($breakpoints, "max-mobile-landscape-tablet-portrait-width")) { + width: 100vw; } } diff --git a/assets/css/_map_page.scss b/assets/css/_map_page.scss index 1f0e72826..76c832e9b 100644 --- a/assets/css/_map_page.scss +++ b/assets/css/_map_page.scss @@ -22,7 +22,7 @@ $z-map-page-context: ( z-index: map-get($z-map-page-context, "map"); .c-map-page__input-and-results--visible ~ & { - @media screen and (max-width: $mobile-portrait-max-width) { + @media screen and (max-width: map-get($old-breakpoints, "mobile-portrait-max-width")) { filter: blur(3.25px); } } @@ -102,7 +102,7 @@ $z-map-page-context: ( display: none; .c-map-page__input-and-results--visible ~ & { - @media screen and (max-width: $mobile-portrait-max-width) { + @media screen and (max-width: map-get($old-breakpoints, "mobile-portrait-max-width")) { // Make button clickable display: block; // Force Flex + Posistion to fill area diff --git a/assets/css/_notification_drawer.scss b/assets/css/_notification_drawer.scss index cf513e729..e8c5ff7a3 100644 --- a/assets/css/_notification_drawer.scss +++ b/assets/css/_notification_drawer.scss @@ -10,10 +10,10 @@ width: 23.5rem; z-index: map-get($z-page-layout-context, "view"); - @media screen and (max-width: $mobile-max-width) { - width: 100%; + @media screen and (max-width: map-get($breakpoints, "max-mobile-landscape-tablet-portrait-width")) { + width: 100vw; } - @media screen and (max-width: $mobile-portrait-max-width) { + @media screen and (max-width: map-get($breakpoints, "max-mobile-width")) { position: fixed; bottom: 0; } diff --git a/assets/css/_picker_container.scss b/assets/css/_picker_container.scss index d447a0aee..e52fb8ec9 100644 --- a/assets/css/_picker_container.scss +++ b/assets/css/_picker_container.scss @@ -35,7 +35,7 @@ display: none; } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .c-picker-container { --picker-container-width: min( #{$mobile-route-picker-width}, diff --git a/assets/css/_properties_panel.scss b/assets/css/_properties_panel.scss index 83a134c05..4808e7450 100644 --- a/assets/css/_properties_panel.scss +++ b/assets/css/_properties_panel.scss @@ -11,14 +11,10 @@ width: 23.5rem; z-index: map-get($z-page-layout-context, "properties-panel"); - @media screen and (max-width: $mobile-max-width) { + @media screen and (max-width: map-get($breakpoints, "max-mobile-landscape-tablet-portrait-width")) { width: 100vw; - - .l-nav__app-content & { - width: 100%; - } } - @media screen and (max-width: $mobile-portrait-max-width) { + @media screen and (max-width: map-get($breakpoints, "max-mobile-width")) { position: fixed; bottom: 0; } diff --git a/assets/css/_search_page.scss b/assets/css/_search_page.scss index d86fef322..c9d23fe5c 100644 --- a/assets/css/_search_page.scss +++ b/assets/css/_search_page.scss @@ -61,7 +61,7 @@ $z-search-page-context: ( padding: 0.625rem 1rem 0 1rem; } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .c-search-page { flex-direction: column; } diff --git a/assets/css/_skate_ui.scss b/assets/css/_skate_ui.scss index 71ef4a0e7..2f389d1fa 100644 --- a/assets/css/_skate_ui.scss +++ b/assets/css/_skate_ui.scss @@ -1,3 +1,9 @@ +$breakpoints: ( + "max-mobile-width": 480px, + "max-mobile-landscape-tablet-portrait-width": 800px, + "max-tablet-width": 1340px, +); + // #region Text Styles [v2] // https://www.notion.so/mbta-downtown-crossing/2022-12-19-Type-Styles-6f6c90eb449248b7a954e234b718137f diff --git a/assets/css/_swings_view.scss b/assets/css/_swings_view.scss index 26142b6b2..3ce666ef5 100644 --- a/assets/css/_swings_view.scss +++ b/assets/css/_swings_view.scss @@ -18,19 +18,18 @@ } // Full width on mobile portrait, to be updated with more responsive designs - @media screen and (max-width: 480px) { + @media screen and (max-width: map-get($breakpoints, "max-mobile-landscape-tablet-portrait-width")) { .l-nav__app-content & { - width: 100%; + width: 100vw; .c-swings-view__table { width: 100%; } } } - @media screen and (max-width: $mobile-portrait-max-width) { + @media screen and (max-width: map-get($breakpoints, "max-mobile-width")) { position: fixed; bottom: 0; - width: 100vw; } } @@ -215,7 +214,7 @@ } } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .c-swings-view__header { padding-left: 1.75rem; } diff --git a/assets/css/_ui_kit.scss b/assets/css/_ui_kit.scss index 7e32eb1b2..84479f354 100644 --- a/assets/css/_ui_kit.scss +++ b/assets/css/_ui_kit.scss @@ -441,7 +441,7 @@ $font-family-route-pill: "Helvetica Neue", Helvetica, Arial, sans-serif; filter: blur(5px); } -@media screen and (max-width: $mobile-max-width) { +@media screen and (max-width: map-get($old-breakpoints, "mobile-max-width")) { .blurred-mobile { @include blur; } diff --git a/assets/css/app.scss b/assets/css/app.scss index 7ce00e550..59fe82c88 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,6 +1,7 @@ -$non-mobile-min-width: 768px; -$mobile-max-width: $non-mobile-min-width - 1; -$mobile-portrait-max-width: 480px; +$old-breakpoints: ( + "mobile-max-width": 767px, + "mobile-portrait-max-width": 480px, +); $tab-bar-width: 3rem; $drawer-tab-width: 2rem; $route-picker-width: 21.875rem; diff --git a/assets/src/components/nav.tsx b/assets/src/components/nav.tsx index 428d9910c..bcf5324af 100644 --- a/assets/src/components/nav.tsx +++ b/assets/src/components/nav.tsx @@ -6,6 +6,7 @@ import LeftNav from "./nav/leftNav" import TopNav from "./nav/topNav" import MobilePortraitNav from "./nav/mobilePortraitNav" import { StateDispatchContext } from "../contexts/stateDispatchContext" +import { usePanelStateFromStateDispatchContext } from "../hooks/usePanelState" interface Props { children?: React.ReactNode @@ -15,19 +16,24 @@ const Nav: React.FC = ({ children }) => { const [, dispatch] = useContext(StateDispatchContext) const deviceType = useScreenSize() + const { isViewOpen } = usePanelStateFromStateDispatchContext() + switch (deviceType) { case "mobile": return (
{children}
- +
) case "mobile_landscape_tablet_portrait": return (
{children}
-
+