Commit 5cb9197b authored by tom's avatar tom

add link to logo

parent 12f23e5b
...@@ -16,9 +16,10 @@ const Burger = () => { ...@@ -16,9 +16,10 @@ const Burger = () => {
setNetworkMenuVisibility((flag) => !flag); setNetworkMenuVisibility((flag) => !flag);
}, []); }, []);
const handleNetworkLogoClick = React.useCallback(() => { const handleNetworkLogoClick = React.useCallback((event: React.SyntheticEvent) => {
isNetworkMenuOpened && event.preventDefault();
setNetworkMenuVisibility(false); setNetworkMenuVisibility(false);
}, []); }, [ isNetworkMenuOpened ]);
return ( return (
<> <>
......
import { Icon, Box, useColorModeValue } from '@chakra-ui/react'; import { Icon, Box, useColorModeValue } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react'; import React from 'react';
import logoIcon from 'icons/logo.svg'; import logoIcon from 'icons/logo.svg';
import useBasePath from 'lib/hooks/useBasePath';
import getDefaultTransitionProps from 'theme/utils/getDefaultTransitionProps'; import getDefaultTransitionProps from 'theme/utils/getDefaultTransitionProps';
interface Props { interface Props {
isCollapsed?: boolean; isCollapsed?: boolean;
onClick?: () => void; onClick?: (event: React.SyntheticEvent) => void;
} }
const NetworkLogo = ({ isCollapsed, onClick }: Props) => { const NetworkLogo = ({ isCollapsed, onClick }: Props) => {
const logoColor = useColorModeValue('blue.600', 'white'); const logoColor = useColorModeValue('blue.600', 'white');
const href = useBasePath();
return ( return (
<Box <NextLink href={ href } passHref>
width={ isCollapsed ? '0' : '113px' } <Box
display="inline-flex" as="a"
overflow="hidden" width={ isCollapsed ? '0' : '113px' }
onClick={ onClick } display="inline-flex"
{ ...getDefaultTransitionProps({ transitionProperty: 'width' }) } overflow="hidden"
> onClick={ onClick }
<Icon { ...getDefaultTransitionProps({ transitionProperty: 'width' }) }
as={ logoIcon } >
width="113px" <Icon
height="20px" as={ logoIcon }
color={ logoColor } width="113px"
{ ...getDefaultTransitionProps() } height="20px"
/> color={ logoColor }
</Box> { ...getDefaultTransitionProps() }
/>
</Box>
</NextLink>
); );
}; };
......
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