From 4f9280e7978fdaca89db8bab0571c72da107d8c0 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 23 Apr 2023 12:03:38 -0700 Subject: [PATCH] Fix basic Main styled components --- frontend/src/basic/Main.tsx | 42 +++++++++++++++------------- frontend/src/basic/NavBar/NavBar.tsx | 1 + 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/frontend/src/basic/Main.tsx b/frontend/src/basic/Main.tsx index f36e265c..ba4a9a68 100644 --- a/frontend/src/basic/Main.tsx +++ b/frontend/src/basic/Main.tsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react'; import { MemoryRouter, BrowserRouter, Routes, Route } from 'react-router-dom'; -import { Box, Slide, Typography } from '@mui/material'; +import { Box, Slide, Typography, styled } from '@mui/material'; import RobotPage from './RobotPage'; import MakerPage from './MakerPage'; @@ -18,7 +18,22 @@ import { UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext'; const Router = window.NativeRobosats === undefined ? BrowserRouter : MemoryRouter; -const Main = (): JSX.Element => { +const TestnetTypography = styled(Typography)({ + height: 0, +}); + +interface MainBoxProps { + navbarHeight: number; +} + +const MainBox = styled(Box)((props) => ({ + position: 'absolute', + top: '50%', + left: '50%', + transform: `translate(-50%, -50%) translate(0, -${props.navbarHeight / 2}em)`, +})); + +const Main: React.FC = () => { const { t } = useTranslation(); const { settings, @@ -55,23 +70,14 @@ const Main = (): JSX.Element => { windowWidth={windowSize.width} /> {settings.network === 'testnet' ? ( -
- - {t('Using Testnet Bitcoin')} - -
+ + {t('Using Testnet Bitcoin')} + ) : ( <> )} - + {['/robot/:refCode?', '/', ''].map((path, index) => { return ( @@ -153,10 +159,8 @@ const Main = (): JSX.Element => { } /> - -
- -
+ + ); diff --git a/frontend/src/basic/NavBar/NavBar.tsx b/frontend/src/basic/NavBar/NavBar.tsx index f8da58ea..f0f409f6 100644 --- a/frontend/src/basic/NavBar/NavBar.tsx +++ b/frontend/src/basic/NavBar/NavBar.tsx @@ -16,6 +16,7 @@ import { } from '@mui/icons-material'; import RobotAvatar from '../../components/RobotAvatar'; import { AppContext, UseAppStoreType, closeAll } from '../../contexts/AppContext'; +import styled from '@emotion/styled'; interface NavBarProps { width: number;