Commit 201be844 authored by Max Alekseenko's avatar Max Alekseenko

remove arrow functions from props

parent bd8afb6a
import type { ButtonProps } from '@chakra-ui/react'; import type { ButtonProps } from '@chakra-ui/react';
import { Button, chakra, Tooltip } from '@chakra-ui/react'; import { Button, chakra, Tooltip } from '@chakra-ui/react';
import React from 'react'; import React, { useCallback } from 'react';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
...@@ -18,6 +18,11 @@ const RewardsButton = ({ variant = 'header', size }: Props) => { ...@@ -18,6 +18,11 @@ const RewardsButton = ({ variant = 'header', size }: Props) => {
const { isInitialized, apiToken, openLoginModal, dailyRewardQuery, balancesQuery } = useRewardsContext(); const { isInitialized, apiToken, openLoginModal, dailyRewardQuery, balancesQuery } = useRewardsContext();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const isLoading = !isInitialized || dailyRewardQuery.isLoading || balancesQuery.isLoading; const isLoading = !isInitialized || dailyRewardQuery.isLoading || balancesQuery.isLoading;
const handleFocus = useCallback((e: React.FocusEvent<HTMLButtonElement>) => {
e.preventDefault();
}, []);
return ( return (
<Tooltip <Tooltip
label="Earn merits for using Blockscout" label="Earn merits for using Blockscout"
...@@ -34,7 +39,7 @@ const RewardsButton = ({ variant = 'header', size }: Props) => { ...@@ -34,7 +39,7 @@ const RewardsButton = ({ variant = 'header', size }: Props) => {
as={ apiToken ? LinkInternal : 'button' } as={ apiToken ? LinkInternal : 'button' }
{ ...(apiToken ? { href: route({ pathname: '/account/rewards' }) } : {}) } { ...(apiToken ? { href: route({ pathname: '/account/rewards' }) } : {}) }
onClick={ apiToken ? undefined : openLoginModal } onClick={ apiToken ? undefined : openLoginModal }
onFocus={ e => e.preventDefault() } // eslint-disable-line onFocus={ handleFocus }
fontSize="sm" fontSize="sm"
size={ size } size={ size }
px={ !isLoading && Boolean(apiToken) ? 2.5 : 4 } px={ !isLoading && Boolean(apiToken) ? 2.5 : 4 }
......
import type { ButtonProps } from '@chakra-ui/react'; import type { ButtonProps } from '@chakra-ui/react';
import { Button, Tooltip, Box, HStack } from '@chakra-ui/react'; import { Button, Tooltip, Box, HStack } from '@chakra-ui/react';
import type { UseQueryResult } from '@tanstack/react-query'; import type { UseQueryResult } from '@tanstack/react-query';
import React from 'react'; import React, { useCallback, useState } from 'react';
import type { UserInfo } from 'types/api/account'; import type { UserInfo } from 'types/api/account';
...@@ -23,7 +23,7 @@ interface Props { ...@@ -23,7 +23,7 @@ interface Props {
} }
const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => { const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }: Props, ref: React.ForwardedRef<HTMLButtonElement>) => {
const [ isFetched, setIsFetched ] = React.useState(false); const [ isFetched, setIsFetched ] = useState(false);
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const { data, isLoading } = profileQuery; const { data, isLoading } = profileQuery;
...@@ -36,6 +36,10 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }: ...@@ -36,6 +36,10 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }:
} }
}, [ isLoading ]); }, [ isLoading ]);
const handleFocus = useCallback((e: React.FocusEvent<HTMLButtonElement>) => {
e.preventDefault();
}, []);
const content = (() => { const content = (() => {
if (web3AccountWithDomain.address) { if (web3AccountWithDomain.address) {
return ( return (
...@@ -76,7 +80,7 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }: ...@@ -76,7 +80,7 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending }:
size={ size } size={ size }
variant={ variant } variant={ variant }
onClick={ onClick } onClick={ onClick }
onFocus={ e => e.preventDefault() } // eslint-disable-line onFocus={ handleFocus }
data-selected={ dataExists } data-selected={ dataExists }
data-warning={ isAutoConnectDisabled } data-warning={ isAutoConnectDisabled }
fontSize="sm" fontSize="sm"
......
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