2020-04-04 05:39:53 +00:00
|
|
|
import React from 'react';
|
|
|
|
import Spinner from '@/components/elements/Spinner';
|
|
|
|
import { CSSTransition } from 'react-transition-group';
|
2020-07-04 22:19:46 +00:00
|
|
|
import Fade from '@/components/elements/Fade';
|
|
|
|
import tw from 'twin.macro';
|
2020-04-04 05:39:53 +00:00
|
|
|
|
|
|
|
const InputSpinner = ({ visible, children }: { visible: boolean, children: React.ReactNode }) => (
|
2020-07-04 22:19:46 +00:00
|
|
|
<div css={tw`relative`}>
|
|
|
|
<Fade
|
|
|
|
appear
|
|
|
|
unmountOnExit
|
2020-04-04 05:39:53 +00:00
|
|
|
in={visible}
|
2020-07-04 22:19:46 +00:00
|
|
|
timeout={250}
|
2020-04-04 05:39:53 +00:00
|
|
|
>
|
2020-07-04 22:19:46 +00:00
|
|
|
<div css={tw`absolute right-0 h-full flex items-center justify-end pr-3`}>
|
2020-07-04 19:39:55 +00:00
|
|
|
<Spinner size={'small'}/>
|
2020-04-04 05:39:53 +00:00
|
|
|
</div>
|
2020-07-04 22:19:46 +00:00
|
|
|
</Fade>
|
2020-04-04 05:39:53 +00:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default InputSpinner;
|