ant-design/components/statistic/Countdown.tsx
𝑾𝒖𝒙𝒉 df21e54316
refactor(StatisticTimer): defensively set type after props to prevent… (#53502)
* refactor(StatisticTimer): defensively set type after props to prevent override

* docs(statistic): mark Statistic.Countdown as deprecated and update documentation
2025-04-15 14:28:25 +08:00

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);