Skip to content

Commit c15b469

Browse files
committed
💄 style: improve loading
1 parent 2aedb73 commit c15b469

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"polished": "^4.2.2",
6262
"qs": "^6.11.2",
6363
"react": "^18",
64-
"react-animated-ellipsis": "^1.0.0",
6564
"react-dom": "^18",
6665
"react-i18next": "^14.0.0",
6766
"react-image-size": "^2.3.2",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { createStyles } from 'antd-style';
2+
import React, { memo } from 'react';
3+
4+
const useStyles = createStyles(({ css, token }) => ({
5+
container: css`
6+
aspect-ratio: 4;
7+
width: 24px;
8+
9+
background: radial-gradient(circle closest-side, ${token.colorTextLightSolid} 40%, #0000) 0 /
10+
calc(100% / 3) 80% space;
11+
clip-path: inset(0 100% 0 0);
12+
13+
animation: step 0.7s steps(4) infinite;
14+
15+
@keyframes step {
16+
to {
17+
clip-path: inset(0 -34% 0 0);
18+
}
19+
}
20+
`,
21+
}));
22+
23+
const ReactAnimatedEllipsis = memo(() => {
24+
const { styles } = useStyles();
25+
26+
return <div className={styles.container} />;
27+
});
28+
29+
export default ReactAnimatedEllipsis;

src/features/Preview/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import { useSize } from 'ahooks';
22
import { Progress } from 'antd';
33
import { createStyles } from 'antd-style';
44
import { memo, useEffect, useRef } from 'react';
5-
// @ts-ignore
6-
import ReactAnimatedEllipsis from 'react-animated-ellipsis';
75
import { useTranslation } from 'react-i18next';
86
import { Center } from 'react-layout-kit';
97

108
import { midjourneySelectors, useMidjourneyStore } from '@/store/midjourney';
119

10+
import ReactAnimatedEllipsis from './AnimatedEllipsis';
1211
import Guide from './Guide';
1312
import ImagePreview from './ImagePreview';
1413
import Loading from './Loading';
@@ -30,6 +29,7 @@ const useStyles = createStyles(({ css, token, cx, stylish, prefixCls }) => ({
3029
border-radius: 50%;
3130
.${prefixCls}-progress-text {
3231
font-family: ${token.fontFamilyCode};
32+
color: ${token.colorTextLightSolid};
3333
}
3434
`,
3535
),
@@ -67,8 +67,9 @@ const Preview = memo(() => {
6767
{showProgress && (
6868
<div className={styles.process}>
6969
{progress === 0 ? (
70-
<Center className={styles.waiting} height={72} horizontal width={72}>
71-
{t('task.starting')} <ReactAnimatedEllipsis fontSize="1rem" />
70+
<Center className={styles.waiting} gap={2} height={72} horizontal width={72}>
71+
<div>{t('task.starting')}</div>
72+
<ReactAnimatedEllipsis />
7273
</Center>
7374
) : (
7475
<Progress percent={progress} size="small" type="circle" />

0 commit comments

Comments
 (0)