Skip to content

Commit 45ed4a3

Browse files
authored
Merge pull request #3699 from IntersectMBO/fix/3681-red-banner-overlapping-navigation
fix: overlapping banners over app content
2 parents 412a93f + ea68d94 commit 45ed4a3

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

govtool/frontend/src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ export default () => {
9393
}, [checkTheWalletIsActive]);
9494

9595
return (
96-
<>
96+
<TopBanners>
9797
<ScrollToTop />
98-
<TopBanners />
9998
<Routes>
10099
<Route path={PATHS.home} element={<Home />} />
101100
<Route path={PATHS.governanceActions} element={<GovernanceActions />} />
@@ -226,6 +225,6 @@ export default () => {
226225
{modals[modal.type].component!}
227226
</Modal>
228227
)}
229-
</>
228+
</TopBanners>
230229
);
231230
};

govtool/frontend/src/components/organisms/DashboardTopNav.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
useGetVoterInfo,
99
useScreenDimension,
1010
} from "@hooks";
11-
import { DashboardDrawerMobile } from "@organisms";
11+
import {
12+
DashboardDrawerMobile,
13+
useMaintenanceEndingBannerContext,
14+
} from "@organisms";
1215
import { useCardano } from "@context";
1316

1417
type DashboardTopNavProps = {
@@ -28,6 +31,8 @@ export const DashboardTopNav = ({
2831
const { isEnableLoading } = useCardano();
2932
const { voter } = useGetVoterInfo();
3033
const { dRepVotingPower } = useGetDRepVotingPowerQuery(voter);
34+
const { height: maintenanceEndingBannerHeight } =
35+
useMaintenanceEndingBannerContext();
3136

3237
const openDrawer = () => {
3338
setIsDrawerOpen(true);
@@ -53,7 +58,7 @@ export const DashboardTopNav = ({
5358
alignItems: "center",
5459
backdropFilter: "blur(10px)",
5560
backgroundColor:
56-
windowScroll > POSITION_TO_BLUR
61+
windowScroll > POSITION_TO_BLUR + maintenanceEndingBannerHeight
5762
? "rgba(256, 256, 256, 0.7)"
5863
: isMobile
5964
? "#FBFBFF59"
@@ -65,7 +70,7 @@ export const DashboardTopNav = ({
6570
minHeight: isMobile ? 36 : 48,
6671
px: isMobile ? 2 : 5,
6772
py: 3,
68-
top: 0,
73+
top: maintenanceEndingBannerHeight || 0,
6974
width: "fill-available",
7075
zIndex: 100,
7176
}}

govtool/frontend/src/components/organisms/Drawer.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ export const Drawer = () => {
2626
flexDirection: "column",
2727
height: "100vh",
2828
position: "sticky",
29-
top: maintenanceEndingBannerHeight,
3029
width: `${DRAWER_WIDTH}px`,
31-
30+
top: maintenanceEndingBannerHeight || 0,
3231
overflowY: "auto",
33-
maxHeight: "100vh",
32+
maxHeight: `calc(100vh - ${maintenanceEndingBannerHeight || 0}px)`,
3433
}}
3534
>
3635
<NavLink

govtool/frontend/src/components/organisms/MaintenanceEndingBanner/MaintenanceEndingBanner.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export const MaintenanceEndingBanner = () => {
2020
width: "100%",
2121
overflow: "hidden",
2222
transition: "all 0.3s ease-in-out",
23+
position: "sticky",
24+
top: 0,
25+
zIndex: 1200,
2326
}}
2427
>
2528
{/* Banner Header */}

govtool/frontend/src/components/organisms/TopBanners.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { PropsWithChildren } from "react";
12
import { Box, Link, Typography } from "@mui/material";
23
import { Trans, useTranslation } from "react-i18next";
34
import { useAppContext } from "@/context";
45
import { LINKS } from "@/consts/links";
56
import { MaintenanceEndingBanner } from "./MaintenanceEndingBanner";
67

7-
export const TopBanners = () => {
8+
export const TopBanners = ({ children }: PropsWithChildren) => {
89
const { isMainnet, networkName, isInBootstrapPhase, isAppInitializing } =
910
useAppContext();
1011
const { t } = useTranslation();
@@ -14,7 +15,7 @@ export const TopBanners = () => {
1415
}
1516

1617
return (
17-
<>
18+
<Box>
1819
<Box>
1920
{/* NETWORK BANNER */}
2021
{!isMainnet && (
@@ -48,16 +49,7 @@ export const TopBanners = () => {
4849
</Box>
4950

5051
{/* GOVTOOL MAINTENANCE ENDING SOON BANNER */}
51-
<Box
52-
sx={{
53-
position: "sticky",
54-
top: 0,
55-
width: "100%",
56-
zIndex: 1200,
57-
}}
58-
>
59-
<MaintenanceEndingBanner />
60-
</Box>
52+
<MaintenanceEndingBanner />
6153

6254
{/* BOOTSTRAPPING BANNER */}
6355
<Box>
@@ -89,6 +81,7 @@ export const TopBanners = () => {
8981
</Box>
9082
)}
9183
</Box>
92-
</>
84+
{children}
85+
</Box>
9386
);
9487
};

0 commit comments

Comments
 (0)