ant-design/components/spin/Indicator/Looper.tsx
thinkasany 8109eca63a
Some checks are pending
Publish Any Commit / build (push) Waiting to run
✅ test v6 / lint (push) Waiting to run
✅ test v6 / test-react-legacy (18, 1/2) (push) Waiting to run
✅ test v6 / test-react-legacy (18, 2/2) (push) Waiting to run
✅ test v6 / test-node (push) Waiting to run
✅ test v6 / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test v6 / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test v6 / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test v6 / test-coverage (push) Blocked by required conditions
✅ test v6 / build (push) Waiting to run
✅ test v6 / test lib/es module (es, 1/2) (push) Waiting to run
✅ test v6 / test lib/es module (es, 2/2) (push) Waiting to run
✅ test v6 / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test v6 / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
feat: ConfigProvider support classNames and styles for Spin (#52823)
* feat: ConfigProvider support classNames and styles for Spin

* update demo

* update demo

* update
2025-02-17 19:33:15 +08:00

36 lines
1003 B
TypeScript

import * as React from 'react';
import classNames from 'classnames';
import Progress from './Progress';
export interface IndicatorProps {
prefixCls: string;
percent?: number;
className?: string;
style?: React.CSSProperties;
}
export default function Looper(props: IndicatorProps) {
const { prefixCls, percent = 0, className, style } = props;
const dotClassName = `${prefixCls}-dot`;
const holderClassName = `${dotClassName}-holder`;
const hideClassName = `${holderClassName}-hidden`;
// ===================== Render =====================
return (
<>
<span
className={classNames(holderClassName, className, percent > 0 && hideClassName)}
style={style}
>
<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} />
</>
);
}