2019-06-23 06:25:38 +00:00
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { CSSTransition } from 'react-transition-group';
|
2019-08-17 23:03:10 +00:00
|
|
|
import Spinner, { SpinnerSize } from '@/components/elements/Spinner';
|
2019-06-23 06:25:38 +00:00
|
|
|
|
2019-08-17 23:03:10 +00:00
|
|
|
interface Props {
|
|
|
|
visible: boolean;
|
|
|
|
fixed?: boolean;
|
|
|
|
size?: SpinnerSize;
|
|
|
|
backgroundOpacity?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ({ size, fixed, visible, backgroundOpacity }: Props) => (
|
2019-06-23 06:25:38 +00:00
|
|
|
<CSSTransition timeout={150} classNames={'fade'} in={visible} unmountOnExit={true}>
|
|
|
|
<div
|
2019-08-04 22:34:46 +00:00
|
|
|
className={classNames('z-50 pin-t pin-l flex items-center justify-center w-full h-full rounded', {
|
|
|
|
absolute: !fixed,
|
|
|
|
fixed: fixed,
|
|
|
|
})}
|
2019-08-17 23:03:10 +00:00
|
|
|
style={{ background: `rgba(0, 0, 0, ${backgroundOpacity || 0.45})` }}
|
2019-06-23 06:25:38 +00:00
|
|
|
>
|
2019-08-17 23:03:10 +00:00
|
|
|
<Spinner size={size}/>
|
2019-06-23 06:25:38 +00:00
|
|
|
</div>
|
|
|
|
</CSSTransition>
|
|
|
|
);
|