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