import React from 'react'; import { ReloadOutlined } from '@ant-design/icons'; import Button from '../button'; import type { Locale } from '../locale'; import Spin from '../spin'; import type { QRCodeProps, StatusRenderInfo } from './interface'; export type QRcodeStatusProps = { prefixCls: string; locale?: Locale['QRCode']; onRefresh?: QRCodeProps['onRefresh']; statusRender?: QRCodeProps['statusRender']; status: StatusRenderInfo['status']; }; const defaultSpin = ; export default function QRcodeStatus({ prefixCls, locale, onRefresh, statusRender, status, }: QRcodeStatusProps) { const defaultExpiredNode = ( <>

{locale?.expired}

{onRefresh && ( )} ); const defaultScannedNode =

{locale?.scanned}

; const defaultNodes = { expired: defaultExpiredNode, loading: defaultSpin, scanned: defaultScannedNode, }; const defaultStatusRender: QRCodeProps['statusRender'] = (info) => defaultNodes[info.status]; const mergedStatusRender = statusRender ?? defaultStatusRender; return mergedStatusRender({ status, locale, onRefresh, }); }