Extract the standard form drawer (width 640, footer actions, destroyOnClose) as FormDrawer; reuse existing usePolling hook. IntelligentEvals becomes the first consumer — create drawer and both 5s pollings switched with zero behaviour change. Includes ui-consistency spec, tickets, and ADR-0005.
37 lines
933 B
TypeScript
37 lines
933 B
TypeScript
import { Button, Drawer, Space } from 'antd'
|
|
import type { ReactNode } from 'react'
|
|
|
|
interface FormDrawerProps {
|
|
title: string
|
|
open: boolean
|
|
onClose: () => void
|
|
onSubmit: () => void
|
|
submitting?: boolean
|
|
okText?: string
|
|
width?: number
|
|
children: ReactNode
|
|
}
|
|
|
|
/** 标准表单抽屉:宽 640、底部取消/主按钮、destroyOnClose。 */
|
|
export default function FormDrawer({
|
|
title, open, onClose, onSubmit, submitting = false, okText = '确定', width = 640, children,
|
|
}: FormDrawerProps) {
|
|
return (
|
|
<Drawer
|
|
title={title}
|
|
open={open}
|
|
onClose={onClose}
|
|
width={width}
|
|
destroyOnClose
|
|
footer={
|
|
<Space style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
|
<Button onClick={onClose}>取消</Button>
|
|
<Button type="primary" loading={submitting} onClick={onSubmit}>{okText}</Button>
|
|
</Space>
|
|
}
|
|
>
|
|
{children}
|
|
</Drawer>
|
|
)
|
|
}
|