mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 23:26:30 +08:00
fix(component): affine loading (#1887)
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user