chore: watch api

This commit is contained in:
jialin
2024-06-28 17:14:34 +08:00
parent 871bca1916
commit cf0113e8d8
35 changed files with 1171 additions and 627 deletions
+50 -13
View File
@@ -1,9 +1,14 @@
import { Progress } from 'antd';
import { Progress, Tooltip } from 'antd';
import { memo, useMemo } from 'react';
const RenderProgress = memo(
(props: { percent: number; steps?: number; download?: boolean }) => {
const { percent, steps = 5, download } = props;
(props: {
percent: number;
steps?: number;
download?: boolean;
label?: React.ReactNode;
}) => {
const { percent, steps = 5, download, label } = props;
const strokeColor = useMemo(() => {
if (download) {
@@ -19,16 +24,48 @@ const RenderProgress = memo(
}, [percent]);
return (
<Progress
steps={steps}
format={() => {
return (
<span style={{ color: 'var(--ant-color-text)' }}>{percent}%</span>
);
}}
percent={percent}
strokeColor={strokeColor}
/>
<>
{label ? (
<Tooltip title={label}>
<Progress
percentPosition={{ align: 'center', type: 'inner' }}
size={[undefined, 12]}
format={() => {
return (
<span
style={{
color: 'var(--ant-color-text)'
}}
>
{percent}%
</span>
);
}}
percent={percent}
strokeColor={strokeColor}
></Progress>
</Tooltip>
) : (
<Progress
type="line"
percentPosition={{ align: 'center', type: 'inner' }}
size={[undefined, 12]}
format={() => {
return (
<span
style={{
color: 'var(--ant-color-text)'
}}
>
{percent}%
</span>
);
}}
percent={percent}
strokeColor={strokeColor}
></Progress>
)}
</>
);
}
);