Commit 1d96aa0b authored by tom's avatar tom

add active state for network button in desktop

parent 5cb9197b
...@@ -43,7 +43,6 @@ const Burger = () => { ...@@ -43,7 +43,6 @@ const Burger = () => {
<Flex alignItems="center" justifyContent="space-between"> <Flex alignItems="center" justifyContent="space-between">
<NetworkLogo onClick={ handleNetworkLogoClick }/> <NetworkLogo onClick={ handleNetworkLogoClick }/>
<NetworkMenuButton <NetworkMenuButton
isCollapsed
isMobile isMobile
isActive={ isNetworkMenuOpened } isActive={ isNetworkMenuOpened }
onClick={ handleNetworkMenuButtonClick } onClick={ handleNetworkMenuButtonClick }
......
...@@ -10,12 +10,16 @@ interface Props { ...@@ -10,12 +10,16 @@ interface Props {
const NetworkMenu = ({ isCollapsed }: Props) => { const NetworkMenu = ({ isCollapsed }: Props) => {
return ( return (
<Popover openDelay={ 300 } placement="right-start" gutter={ 22 } isLazy> <Popover openDelay={ 300 } placement="right-start" gutter={ 22 } isLazy>
<PopoverTrigger> { ({ isOpen }) => (
<Box> <>
<NetworkMenuButton isCollapsed={ isCollapsed }/> <PopoverTrigger>
</Box> <Box marginLeft={ isCollapsed ? '0px' : '7px' }>
</PopoverTrigger> <NetworkMenuButton isActive={ isOpen }/>
<NetworkMenuContentDesktop/> </Box>
</PopoverTrigger>
<NetworkMenuContentDesktop/>
</>
) }
</Popover> </Popover>
); );
}; };
......
...@@ -5,13 +5,12 @@ import networksIcon from 'icons/networks.svg'; ...@@ -5,13 +5,12 @@ import networksIcon from 'icons/networks.svg';
import getDefaultTransitionProps from 'theme/utils/getDefaultTransitionProps'; import getDefaultTransitionProps from 'theme/utils/getDefaultTransitionProps';
interface Props { interface Props {
isCollapsed?: boolean;
isMobile?: boolean; isMobile?: boolean;
isActive?: boolean; isActive?: boolean;
onClick?: () => void; onClick?: () => void;
} }
const NetworkMenuButton = ({ isCollapsed, isMobile, isActive, onClick }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => { const NetworkMenuButton = ({ isMobile, isActive, onClick }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => {
const defaultIconColor = useColorModeValue('gray.600', 'gray.400'); const defaultIconColor = useColorModeValue('gray.600', 'gray.400');
const bgColorMobile = useColorModeValue('blue.50', 'gray.800'); const bgColorMobile = useColorModeValue('blue.50', 'gray.800');
const iconColorMobile = useColorModeValue('blue.700', 'blue.50'); const iconColorMobile = useColorModeValue('blue.700', 'blue.50');
...@@ -25,7 +24,7 @@ const NetworkMenuButton = ({ isCollapsed, isMobile, isActive, onClick }: Props, ...@@ -25,7 +24,7 @@ const NetworkMenuButton = ({ isCollapsed, isMobile, isActive, onClick }: Props,
ref={ ref } ref={ ref }
h="36px" h="36px"
borderRadius="base" borderRadius="base"
backgroundColor={ isMobile && isActive ? bgColorMobile : 'none' } backgroundColor={ isActive ? bgColorMobile : 'none' }
onClick={ onClick } onClick={ onClick }
> >
<Icon <Icon
...@@ -33,9 +32,8 @@ const NetworkMenuButton = ({ isCollapsed, isMobile, isActive, onClick }: Props, ...@@ -33,9 +32,8 @@ const NetworkMenuButton = ({ isCollapsed, isMobile, isActive, onClick }: Props,
width="36px" width="36px"
height="36px" height="36px"
padding="10px" padding="10px"
color={ isMobile && isActive ? iconColorMobile : defaultIconColor } color={ isActive ? iconColorMobile : defaultIconColor }
_hover={{ color: isMobile ? undefined : 'blue.400' }} _hover={{ color: isMobile ? undefined : 'blue.400' }}
marginLeft={ isCollapsed ? '0px' : '7px' }
cursor="pointer" cursor="pointer"
{ ...getDefaultTransitionProps({ transitionProperty: 'margin' }) } { ...getDefaultTransitionProps({ transitionProperty: 'margin' }) }
/> />
......
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