AgentEvalTool/frontend/web/src/components/FormDrawer.tsx
sinohqb d4c254e121 refactor(ui): baseline FormDrawer component and IntelligentEvals dogfood (ui-consistency ticket 01)
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.
2026-08-05 15:34:31 +08:00

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