ant-design/components/spin/Indicator/index.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

29 lines
856 B
TypeScript

import * as React from 'react';
import classNames from 'classnames';
import { cloneElement } from '../../_util/reactNode';
import Looper from './Looper';
export interface IndicatorProps {
prefixCls: string;
indicator?: React.ReactNode;
percent?: number;
className?: string;
style?: React.CSSProperties;
}
export default function Indicator(props: IndicatorProps) {
const { prefixCls, indicator, percent, className, style } = props;
const dotClassName = `${prefixCls}-dot`;
if (indicator && React.isValidElement(indicator)) {
return cloneElement(indicator, (currentProps) => ({
className: classNames(currentProps.className, dotClassName, className),
style: { ...currentProps.style, ...style },
percent,
}));
}
return <Looper prefixCls={prefixCls} percent={percent} className={className} style={style} />;
}