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

28 lines
817 B
TypeScript
Raw Normal View History

import React from 'react';
import Spinner, { SpinnerSize } from '@/components/elements/Spinner';
2020-07-04 19:39:55 +00:00
import Fade from '@/components/elements/Fade';
import tw from 'twin.macro';
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) => (
2020-07-04 19:39:55 +00:00
<Fade timeout={150} in={visible} unmountOnExit>
<div
2020-07-04 19:39:55 +00:00
css={[
tw`top-0 left-0 flex items-center justify-center w-full h-full rounded`,
!fixed ? tw`absolute` : tw`fixed`,
]}
style={{ zIndex: 9999, background: `rgba(0, 0, 0, ${backgroundOpacity || 0.45})` }}
>
<Spinner size={size}/>
</div>
2020-07-04 19:39:55 +00:00
</Fade>
);
2020-02-08 23:23:08 +00:00
export default SpinnerOverlay;