AuthorizeRejectButtons: add a loading animation

This commit is contained in:
Alex Gleason 2023-03-27 16:45:41 -05:00
parent 3b8f43f02d
commit d08a2e215b
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -68,6 +68,7 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
default:
return (
<HStack space={3} alignItems='center'>
<div className='relative'>
<IconButton
src={state === 'rejecting' ? require('@tabler/icons/player-stop-filled.svg') : require('@tabler/icons/x.svg')}
onClick={handleReject}
@ -76,6 +77,11 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
iconClassName='h-6 w-6 text-danger-600'
disabled={state === 'authorizing'}
/>
{(state === 'rejecting') && (
<div className='pointer-events-none absolute inset-0 h-10 w-10 animate-spin rounded-full border-2 border-transparent border-t-danger-600' />
)}
</div>
<div className='relative'>
<IconButton
src={state === 'authorizing' ? require('@tabler/icons/player-stop-filled.svg') : require('@tabler/icons/check.svg')}
onClick={handleAuthorize}
@ -84,6 +90,10 @@ const AuthorizeRejectButtons: React.FC<IAuthorizeRejectButtons> = ({ onAuthorize
iconClassName='h-6 w-6 text-primary-500'
disabled={state === 'rejecting'}
/>
{(state === 'authorizing') && (
<div className='pointer-events-none absolute inset-0 h-10 w-10 animate-spin rounded-full border-2 border-transparent border-t-primary-500' />
)}
</div>
</HStack>
);
}