Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Jul 25, 2023
1 parent 3352f50 commit c710a36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/Layout/Header/NavBar/MainNavLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ButtonProps } from '@chakra-ui/react'
import { Box, Button, Tag, Tooltip, useMediaQuery } from '@chakra-ui/react'
import { memo } from 'react'
import { memo, useCallback } from 'react'
import { useTranslate } from 'react-polyglot'
import type { NavLinkProps } from 'react-router-dom'
import { CircleIcon } from 'components/Icons/Circle'
Expand All @@ -20,6 +20,10 @@ export const MainNavLink = memo(
({ isCompact, onClick, isNew, label, isActive, ...rest }: SidebarLinkProps) => {
const [isLargerThan2xl] = useMediaQuery(`(min-width: ${breakpoints['2xl']})`, { ssr: false })
const translate = useTranslate()
const handleClick: React.MouseEventHandler<HTMLButtonElement> = useCallback(
e => (isActive ? e.preventDefault() : onClick?.(e)),
[isActive, onClick],
)

return (
<Tooltip label={label} isDisabled={isLargerThan2xl || !isCompact} placement='right'>
Expand All @@ -28,7 +32,7 @@ export const MainNavLink = memo(
justifyContent={{ base: isCompact ? 'center' : 'flex-start', '2xl': 'flex-start' }}
variant='nav-link'
isActive={isActive}
onClick={e => (isActive ? e.preventDefault() : onClick?.(e))}
onClick={handleClick}
position='relative'
minWidth={isCompact ? 'auto' : 10}
iconSpacing={isLargerThan2xl ? 4 : isCompact ? 0 : 4}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/TransactionHistory/TransactionHistorySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Input, InputGroup, InputLeftElement, useColorModeValue } from '@chakra-
import { forwardRef, useCallback } from 'react'
import { useTranslate } from 'react-polyglot'

const InputGroupMargin = [2, 3, 6]
const inputGroupMargin = [2, 3, 6]

export const TransactionHistorySearch = forwardRef<
HTMLInputElement,
Expand All @@ -15,7 +15,7 @@ export const TransactionHistorySearch = forwardRef<
[handleInputChange],
)
return (
<InputGroup mr={InputGroupMargin}>
<InputGroup mr={inputGroupMargin}>
<InputLeftElement pointerEvents='none'>
<SearchIcon color={useColorModeValue('gray.300', 'gray.750')} />
</InputLeftElement>
Expand Down

0 comments on commit c710a36

Please sign in to comment.