Skip to content

Commit

Permalink
feat: blur in navbar, fix bug in extrastats placement, add dom to tsc…
Browse files Browse the repository at this point in the history
…onfig, overlayportal
  • Loading branch information
kemuru committed Dec 17, 2024
1 parent 26273b2 commit b3bd4b7
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 46 deletions.
18 changes: 18 additions & 0 deletions web/src/components/OverlayPortal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import ReactDOM from "react-dom";
import styled from "styled-components";

const PortalContainer = styled.div`
position: fixed;
top: 0;
left: 0;
z-index: 9999;
width: 100%;
height: 100%;
`;

const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body);
};

export default OverlayPortal;
24 changes: 9 additions & 15 deletions web/src/layout/Header/DesktopHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { MiniguideHashesType } from "components/Popup/MiniGuides/MainStructureTe
import Onboarding from "components/Popup/MiniGuides/Onboarding";
import RankedVoting from "components/Popup/MiniGuides/RankedVoting";
import Staking from "components/Popup/MiniGuides/Staking";
import OverlayPortal from "components/OverlayPortal";
import { Overlay } from "components/Overlay";

import Logo from "./Logo";
import DappList from "./navbar/DappList";
Expand Down Expand Up @@ -86,16 +88,6 @@ const ConnectWalletContainer = styled.div<{ isConnected: boolean; isDefaultChain
}
`;

const PopupContainer = styled.div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: ${({ theme }) => theme.blackLowOpacity};
`;

const DesktopHeader: React.FC = () => {
const [isDappListOpen, toggleIsDappListOpen] = useToggle(false);
const [isHelpOpen, toggleIsHelpOpen] = useToggle(false);
Expand Down Expand Up @@ -178,11 +170,13 @@ const DesktopHeader: React.FC = () => {
</RightSide>
</Container>
{(isDappListOpen || isHelpOpen || isSettingsOpen) && (
<PopupContainer>
{isDappListOpen && <DappList {...{ toggleIsDappListOpen, isDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen, isHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen, isSettingsOpen, initialTab }} />}
</PopupContainer>
<OverlayPortal>
<Overlay>
{isDappListOpen && <DappList {...{ toggleIsDappListOpen, isDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen, isHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen, isSettingsOpen, initialTab }} />}
</Overlay>
</OverlayPortal>
)}
{isJurorLevelsMiniGuideOpen && <JurorLevels toggleMiniGuide={toggleIsJurorLevelsMiniGuideOpen} />}
{isAppealMiniGuideOpen && <Appeal toggleMiniGuide={toggleIsAppealMiniGuideOpen} />}
Expand Down
21 changes: 8 additions & 13 deletions web/src/layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ import DesktopHeader from "./DesktopHeader";
import MobileHeader from "./MobileHeader";

const Container = styled.div`
display: flex;
flex-wrap: wrap;
position: sticky;
padding: 0 24px;
z-index: 10;
top: 0;
width: 100%;
background-color: ${({ theme }) => (theme.name === "dark" ? theme.lightBlue : theme.primaryPurple)};
display: flex;
flex-wrap: wrap;
`;

const HeaderContainer = styled.div`
width: 100%;
padding: 0 24px;
background-color: ${({ theme }) => (theme.name === "dark" ? `${theme.lightBlue}A6` : theme.primaryPurple)};
backdrop-filter: ${({ theme }) => (theme.name === "dark" ? "blur(12px)" : "none")};
-webkit-backdrop-filter: ${({ theme }) => (theme.name === "dark" ? "blur(12px)" : "none")}; // Safari support
`;

const Header: React.FC = () => {
return (
<Container>
<HeaderContainer>
<DesktopHeader />
<MobileHeader />
</HeaderContainer>
<DesktopHeader />
<MobileHeader />
</Container>
);
};
Expand Down
23 changes: 8 additions & 15 deletions web/src/layout/Header/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useLockOverlayScroll } from "hooks/useLockOverlayScroll";

import ConnectWallet from "components/ConnectWallet";
import LightButton from "components/LightButton";
import OverlayPortal from "components/OverlayPortal";
import { Overlay } from "components/Overlay";

import { useOpenContext } from "../MobileHeader";
Expand Down Expand Up @@ -69,16 +70,6 @@ const DisconnectWalletButtonContainer = styled.div`
align-items: center;
`;

const PopupContainer = styled.div`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: ${({ theme }) => theme.blackLowOpacity};
`;

export interface ISettings {
toggleIsSettingsOpen: () => void;
initialTab?: number;
Expand Down Expand Up @@ -131,11 +122,13 @@ const NavBar: React.FC = () => {
</StyledOverlay>
</Wrapper>
{(isDappListOpen || isHelpOpen || isSettingsOpen) && (
<PopupContainer>
{isDappListOpen && <DappList {...{ toggleIsDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen }} />}
</PopupContainer>
<OverlayPortal>
<Overlay>
{isDappListOpen && <DappList {...{ toggleIsDappListOpen }} />}
{isHelpOpen && <Help {...{ toggleIsHelpOpen }} />}
{isSettingsOpen && <Settings {...{ toggleIsSettingsOpen }} />}
</Overlay>
</OverlayPortal>
)}
</>
);
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/Home/CourtOverview/ExtraStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const StyledCard = styled.div`
`;

const StyledLabel = styled.label`
margin-top: 24px;
font-size: 14px;
font-weight: 600;
`;
Expand Down
2 changes: 1 addition & 1 deletion web/src/styles/global-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const GlobalStyle = createGlobalStyle`
body {
font-family: "Open Sans", sans-serif;
margin: 0px;
background-color: ${({ theme }) => theme.primaryPurple};
background-color: ${({ theme }) => theme.lightBlue};
}
html {
Expand Down
3 changes: 2 additions & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"resolveJsonModule": true,
"target": "ES2020",
"lib": [
"ESNext.Array"
"ESNext.Array",
"dom"
],
"types": [
"vite/client",
Expand Down

0 comments on commit b3bd4b7

Please sign in to comment.