misc_pterodactyl-panel/resources/scripts/components/elements/SpinnerOverlay.tsx

28 lines
891 B
TypeScript
Raw Normal View History

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