mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 07:28:28 +08:00
d0fd9935c6
* fix: Fix Spin missing default font size when customizing icons * chore: adjust style * test: add test case --------- Co-authored-by: 二货机器人 <smith3816@gmail.com>
26 lines
671 B
TypeScript
26 lines
671 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;
|
|
}
|
|
|
|
export default function Indicator(props: IndicatorProps) {
|
|
const { prefixCls, indicator, percent } = props;
|
|
const dotClassName = `${prefixCls}-dot`;
|
|
|
|
if (indicator && React.isValidElement(indicator)) {
|
|
return cloneElement(indicator, {
|
|
className: classNames(indicator.props.className, dotClassName),
|
|
percent,
|
|
});
|
|
}
|
|
|
|
return <Looper prefixCls={prefixCls} percent={percent} />;
|
|
}
|