2020-11-29 01:25:48 -07:00
|
|
|
import { forwardRef } from 'react';
|
|
|
|
import dynamic from 'next/dynamic';
|
|
|
|
import { Button, Icon } from '@chakra-ui/react';
|
2020-12-20 01:21:24 -07:00
|
|
|
import { useLGState } from '~/hooks';
|
2020-11-29 01:25:48 -07:00
|
|
|
|
|
|
|
import type { ButtonProps } from '@chakra-ui/react';
|
|
|
|
|
|
|
|
const ChevronLeft = dynamic<MeronexIcon>(() =>
|
|
|
|
import('@meronex/icons/fi').then(i => i.FiChevronLeft),
|
|
|
|
);
|
|
|
|
|
|
|
|
export const ResetButton = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
2020-12-20 01:21:24 -07:00
|
|
|
const { isSubmitting } = useLGState();
|
2020-11-29 01:25:48 -07:00
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
ref={ref}
|
|
|
|
color="current"
|
|
|
|
variant="ghost"
|
|
|
|
aria-label="Reset Form"
|
|
|
|
opacity={isSubmitting.value ? 1 : 0}
|
|
|
|
{...props}>
|
2020-12-13 01:49:13 -07:00
|
|
|
<Icon as={ChevronLeft} boxSize={8} />
|
2020-11-29 01:25:48 -07:00
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
});
|