fix(component): affine loading (#1887)

This commit is contained in:
Himself65
2023-04-11 23:48:42 -05:00
committed by GitHub
parent 5535440c55
commit 9dcb96839b
7 changed files with 91 additions and 125 deletions
@@ -1,18 +1,30 @@
import { useTheme } from '@mui/material';
import type { FC } from 'react';
import { InternalLottie } from '../internal-lottie';
import dark from './loading-black.json';
import light from './loading-white.json';
export const AffineLoading = () => {
export type AffineLoadingProps = {
loop?: boolean;
autoplay?: boolean;
autoReverse?: boolean;
};
export const AffineLoading: FC<AffineLoadingProps> = ({
loop = false,
autoplay = false,
autoReverse = false,
}) => {
const theme = useTheme();
const isDark = theme.palette.mode === 'dark';
return (
<InternalLottie
key={isDark ? 'dark' : 'light'}
options={{
loop: false,
autoplay: false,
loop,
autoplay,
autoReverse,
animationData: isDark ? light : dark,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice',