diff --git a/src/app/components/header/components/desktop-header.tsx b/src/app/components/header/components/desktop-header.tsx new file mode 100644 index 00000000..4605fe15 --- /dev/null +++ b/src/app/components/header/components/desktop-header.tsx @@ -0,0 +1,38 @@ +import React from 'react'; + +import { HStack } from '@chakra-ui/react'; +import { Account } from '@components/account/account'; +import { CompanyWebsiteButton } from '@components/company-website-button/company-website-button'; +import { NetworkBox } from '@components/network/network'; + +import { HeaderLayout } from './header.layout'; +import { NavigationTabs } from './tabs'; + +interface DesktopHeaderProps { + isNetworkMenuOpen: boolean; + setIsNetworkMenuOpen: (isOpen: boolean) => void; + handleTabClick: (route: string) => void; +} + +const DesktopHeader: React.FC = ({ + isNetworkMenuOpen, + setIsNetworkMenuOpen, + handleTabClick, +}) => { + return ( + + + + + + + <> + + + + + + ); +}; + +export default DesktopHeader; diff --git a/src/app/components/header/components/mobile-header.tsx b/src/app/components/header/components/mobile-header.tsx new file mode 100644 index 00000000..237c62c5 --- /dev/null +++ b/src/app/components/header/components/mobile-header.tsx @@ -0,0 +1,58 @@ +import React from 'react'; +import { useNavigate } from 'react-router-dom'; + +import { HamburgerIcon } from '@chakra-ui/icons'; +import { HStack, IconButton, Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/react'; +import { Account } from '@components/account/account'; +import { CompanyWebsiteButton } from '@components/company-website-button/company-website-button'; +import { NetworkBox } from '@components/network/network'; + +import { HeaderLayout } from './header.layout'; + +interface MobileHeaderProps { + isNetworkMenuOpen: boolean; + setIsNetworkMenuOpen: (isOpen: boolean) => void; + isActiveTabs: boolean; +} + +const MobileHeader: React.FC = ({ + isNetworkMenuOpen, + setIsNetworkMenuOpen, + isActiveTabs, +}) => { + const navigate = useNavigate(); + return ( + + + + + + + + } + height={'40px'} + width={'40px'} + /> + + navigate('/')}>Points + navigate('/proof-of-reserve')}>Proof of Reserve + {isActiveTabs && ( + <> + navigate('/mint-withdraw')}> + Mint/Withdraw dlcBTC + + navigate('/my-vaults')}>My Vaults + + )} + + + + + + ); +}; + +export default MobileHeader; diff --git a/src/app/components/header/header.tsx b/src/app/components/header/header.tsx index e4825df2..c7d8cd02 100644 --- a/src/app/components/header/header.tsx +++ b/src/app/components/header/header.tsx @@ -1,30 +1,16 @@ import React, { useEffect, useState } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; -import { HamburgerIcon } from '@chakra-ui/icons'; -import { - HStack, - IconButton, - Menu, - MenuButton, - MenuItem, - MenuList, - VStack, - useBreakpointValue, -} from '@chakra-ui/react'; -import { Account } from '@components/account/account'; -import { CompanyWebsiteButton } from '@components/company-website-button/company-website-button'; -import { HeaderLayout } from '@components/header/components/header.layout'; -import { NetworkBox } from '@components/network/network'; +import { VStack, useBreakpointValue } from '@chakra-ui/react'; import { useActiveTabs } from '@hooks/use-active-tabs'; import { useAccount } from 'wagmi'; import { Banner } from './components/banner'; -import { NavigationTabs } from './components/tabs'; +import DesktopHeader from './components/desktop-header'; +import MobileHeader from './components/mobile-header'; export function Header(): React.JSX.Element { const navigate = useNavigate(); - const location = useLocation(); const { chain, isConnected } = useAccount(); const [showBanner, setShowBanner] = useState(false); @@ -56,54 +42,19 @@ export function Header(): React.JSX.Element { }} /> )} - - - - {isMobile ? ( - - - - - } - height={'40px'} - width={'40px'} - /> - - navigate('/')}>Points - navigate('/proof-of-reserve')}> - Proof of Reserve - - {isActiveTabs && ( - <> - navigate('/mint-withdraw')}> - Mint/Withdraw dlcBTC - - navigate('/my-vaults')}>My Vaults - - )} - - - - ) : ( - - )} - - - {!isMobile && ( - <> - - - - )} - - + {isMobile ? ( + + ) : ( + + )} ); }