NapCatQQ/napcat.webui/src/components/button/save_buttons.tsx
时瑾 06f6a542f5
refactor: 优化eslint配置,提升代码质量 (#1341)
* feat: 统一并标准化eslint

* lint: napcat.webui

* lint: napcat.webui

* lint: napcat.core

* build: fix

* lint: napcat.webui

* refactor: 重构eslint

* Update README.md
2025-11-03 16:30:45 +08:00

60 lines
1.2 KiB
TypeScript

import { Button } from '@heroui/button';
import clsx from 'clsx';
import toast from 'react-hot-toast';
import { IoMdRefresh } from 'react-icons/io';
export interface SaveButtonsProps {
onSubmit: () => void
reset: () => void
refresh?: () => void
isSubmitting: boolean
className?: string
}
const SaveButtons: React.FC<SaveButtonsProps> = ({
onSubmit,
reset,
isSubmitting,
refresh,
className,
}) => (
<div
className={clsx(
'max-w-full mx-3 w-96 flex flex-col justify-center gap-3',
className
)}
>
<div className='flex items-center justify-center gap-2 mt-5'>
<Button
color='default'
onPress={() => {
reset();
toast.success('重置成功');
}}
>
</Button>
<Button
color='primary'
isLoading={isSubmitting}
onPress={() => onSubmit()}
>
</Button>
{refresh && (
<Button
isIconOnly
color='secondary'
radius='full'
variant='flat'
onPress={() => refresh()}
>
<IoMdRefresh size={24} />
</Button>
)}
</div>
</div>
);
export default SaveButtons;