import React from 'react'; import { Button, IconButton, Tooltip, useBreakpoint } from '@chakra-ui/react'; import { ArrowsClockwise } from 'phosphor-react'; import { useTranslation } from 'react-i18next'; export interface RefreshButtonProps { onClick: () => void; isDisabled?: boolean; isFetching?: boolean; isCompact?: boolean; ml?: string | number; size?: 'sm' | 'md' | 'lg'; } const _RefreshButton: React.FC = ({ onClick, isDisabled, isFetching, isCompact, ml, size, ...props }) => { const { t } = useTranslation(); const breakpoint = useBreakpoint(); if (!isCompact && breakpoint !== 'base' && breakpoint !== 'sm') { return ( ); } return ( } isDisabled={isDisabled} isLoading={isFetching} ml={ml} {...props} /> ); }; export const RefreshButton = React.memo(_RefreshButton);