Commit 3b97aceb authored by tom's avatar tom

fix network logo in mobile header

parent 67c6404a
...@@ -11,10 +11,6 @@ import WalletMenuMobile from 'ui/snippets/walletMenu/WalletMenuMobile'; ...@@ -11,10 +11,6 @@ import WalletMenuMobile from 'ui/snippets/walletMenu/WalletMenuMobile';
import Burger from './Burger'; import Burger from './Burger';
const LOGO_IMAGE_PROPS = {
margin: '0 auto',
};
type Props = { type Props = {
hideSearchBar?: boolean; hideSearchBar?: boolean;
renderSearchBar?: () => React.ReactNode; renderSearchBar?: () => React.ReactNode;
...@@ -45,13 +41,12 @@ const HeaderMobile = ({ hideSearchBar, renderSearchBar }: Props) => { ...@@ -45,13 +41,12 @@ const HeaderMobile = ({ hideSearchBar, renderSearchBar }: Props) => {
bgColor={ bgColor } bgColor={ bgColor }
width="100%" width="100%"
alignItems="center" alignItems="center"
justifyContent="space-between"
transitionProperty="box-shadow" transitionProperty="box-shadow"
transitionDuration="slow" transitionDuration="slow"
boxShadow={ !inView && scrollDirection === 'down' ? 'md' : 'none' } boxShadow={ !inView && scrollDirection === 'down' ? 'md' : 'none' }
> >
<Burger/> <Burger/>
<NetworkLogo imageProps={ LOGO_IMAGE_PROPS }/> <NetworkLogo flexGrow={ 1 } ml={ 2 }/>
<Flex columnGap={ 2 }> <Flex columnGap={ 2 }>
{ config.features.account.isEnabled ? <ProfileMenuMobile/> : <Box boxSize={ 10 }/> } { config.features.account.isEnabled ? <ProfileMenuMobile/> : <Box boxSize={ 10 }/> }
{ config.features.blockchainInteraction.isEnabled && <WalletMenuMobile/> } { config.features.blockchainInteraction.isEnabled && <WalletMenuMobile/> }
......
import type { StyleProps } from '@chakra-ui/react'; import type { StyleProps } from '@chakra-ui/react';
import { Box, Image, useColorModeValue, Skeleton } from '@chakra-ui/react'; import { Box, Image, useColorModeValue, Skeleton, chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
...@@ -11,6 +11,7 @@ interface Props { ...@@ -11,6 +11,7 @@ interface Props {
isCollapsed?: boolean; isCollapsed?: boolean;
onClick?: (event: React.SyntheticEvent) => void; onClick?: (event: React.SyntheticEvent) => void;
imageProps?: StyleProps; imageProps?: StyleProps;
className?: string;
} }
const LogoFallback = ({ isCollapsed, isSmall, imageProps }: { isCollapsed?: boolean; isSmall?: boolean; imageProps?: StyleProps }) => { const LogoFallback = ({ isCollapsed, isSmall, imageProps }: { isCollapsed?: boolean; isSmall?: boolean; imageProps?: StyleProps }) => {
...@@ -43,7 +44,7 @@ const LogoFallback = ({ isCollapsed, isSmall, imageProps }: { isCollapsed?: bool ...@@ -43,7 +44,7 @@ const LogoFallback = ({ isCollapsed, isSmall, imageProps }: { isCollapsed?: bool
); );
}; };
const NetworkLogo = ({ isCollapsed, onClick, imageProps }: Props) => { const NetworkLogo = ({ isCollapsed, onClick, imageProps, className }: Props) => {
const logoSrc = useColorModeValue(config.UI.sidebar.logo.default, config.UI.sidebar.logo.dark || config.UI.sidebar.logo.default); const logoSrc = useColorModeValue(config.UI.sidebar.logo.default, config.UI.sidebar.logo.dark || config.UI.sidebar.logo.default);
const iconSrc = useColorModeValue(config.UI.sidebar.icon.default, config.UI.sidebar.icon.dark || config.UI.sidebar.icon.default); const iconSrc = useColorModeValue(config.UI.sidebar.icon.default, config.UI.sidebar.icon.dark || config.UI.sidebar.icon.default);
...@@ -53,6 +54,7 @@ const NetworkLogo = ({ isCollapsed, onClick, imageProps }: Props) => { ...@@ -53,6 +54,7 @@ const NetworkLogo = ({ isCollapsed, onClick, imageProps }: Props) => {
return ( return (
<Box <Box
className={ className }
as="a" as="a"
href={ route({ pathname: '/' }) } href={ route({ pathname: '/' }) }
width={{ base: '120px', lg: isCollapsed === false ? '120px' : '30px', xl: isCollapsed ? '30px' : '120px' }} width={{ base: '120px', lg: isCollapsed === false ? '120px' : '30px', xl: isCollapsed ? '30px' : '120px' }}
...@@ -89,4 +91,4 @@ const NetworkLogo = ({ isCollapsed, onClick, imageProps }: Props) => { ...@@ -89,4 +91,4 @@ const NetworkLogo = ({ isCollapsed, onClick, imageProps }: Props) => {
); );
}; };
export default React.memo(NetworkLogo); export default React.memo(chakra(NetworkLogo));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment