mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-19 08:50:53 +08:00

* refactor(StatisticTimer): defensively set type after props to prevent override * docs(statistic): mark Statistic.Countdown as deprecated and update documentation
24 lines
715 B
TypeScript
24 lines
715 B
TypeScript
import * as React from 'react';
|
|
|
|
import { devUseWarning } from '../_util/warning';
|
|
import type { StatisticProps } from './Statistic';
|
|
import type { valueType } from './utils';
|
|
import StatisticTimer from './Timer';
|
|
|
|
export interface CountdownProps extends StatisticProps {
|
|
format?: string;
|
|
onFinish?: () => void;
|
|
onChange?: (value?: valueType) => void;
|
|
}
|
|
|
|
const Countdown: React.FC<CountdownProps> = (props) => {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
const warning = devUseWarning('Countdown');
|
|
|
|
warning.deprecated(false, '<Statistic.Countdown />', '<Statistic.Timer type="countdown" />');
|
|
}
|
|
return <StatisticTimer {...props} type="countdown" />;
|
|
};
|
|
|
|
export default React.memo(Countdown);
|