40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { Button } from '~/components/ui/Button';
|
|
interface ActionButtonsProps {
|
|
onSave?: () => void;
|
|
onSaveDraft?: () => void;
|
|
isEditMode?: boolean;
|
|
showButtons?: boolean;
|
|
}
|
|
|
|
export function ActionButtons({ onSave, onSaveDraft, isEditMode, showButtons = true }: ActionButtonsProps) {
|
|
return (
|
|
<div className="flex justify-center space-x-4 mt-8 mb-4">
|
|
{showButtons && (
|
|
<>
|
|
<button
|
|
type="button"
|
|
className="ant-btn ant-btn-primary min-w-[120px]"
|
|
onClick={onSave}
|
|
>
|
|
<i className="ri-save-line mr-1"></i> {isEditMode ? '保存修改' : '保存'}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
className="ant-btn ant-btn-default min-w-[120px] !hidden"
|
|
onClick={onSaveDraft}
|
|
>
|
|
<i className="ri-draft-line mr-1"></i> {isEditMode ? '另存为草稿' : '保存草稿'}
|
|
</button>
|
|
</>
|
|
)}
|
|
<Button
|
|
type="default"
|
|
className="min-w-[120px] focus:!ring-gray-300"
|
|
onClick={() => window.history.back()}
|
|
icon="ri-arrow-left-line"
|
|
>
|
|
返回
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|