ant-design/components/spin/Indicator/Looper.tsx
二货爱吃白萝卜 0352b2fd2e
feat: Spin support percent (#48657)
* feat: spin support ptg

* chore: ptg

* chore: update demo

* chore: popout component

* chore: adjust logic

* test: update snapshot

* test: update snapshot

* docs: update docs

* test: update snapshot

* test: update snapshot

* test: update snapshot

* chore: back of snapshot

* chore: clean up

* test: fix test case

* chore: fix types

* test: update snapshot

* chore: opt

* test: update testcase

* test: coverage

* test: update snapshot
2024-06-03 11:30:27 +08:00

31 lines
884 B
TypeScript

import * as React from 'react';
import classNames from 'classnames';
import Progress from './Progress';
export interface IndicatorProps {
prefixCls: string;
percent?: number;
}
export default function Looper(props: IndicatorProps) {
const { prefixCls, percent = 0 } = props;
const dotClassName = `${prefixCls}-dot`;
const holderClassName = `${dotClassName}-holder`;
const hideClassName = `${holderClassName}-hidden`;
// ===================== Render =====================
return (
<>
<span className={classNames(holderClassName, percent > 0 && hideClassName)}>
<span className={classNames(dotClassName, `${prefixCls}-dot-spin`)}>
{[1, 2, 3, 4].map((i) => (
<i className={`${prefixCls}-dot-item`} key={i} />
))}
</span>
</span>
<Progress prefixCls={prefixCls} percent={percent} />
</>
);
}