2023-08-25 19:37:56 +03:00
|
|
|
import { ReactElement } from "react";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
|
|
|
import Button from "@/lib/components/ui/Button";
|
|
|
|
|
2023-09-20 17:24:56 +03:00
|
|
|
interface Props extends React.ComponentProps<typeof Button> {
|
2023-08-25 19:37:56 +03:00
|
|
|
handleSubmit: (checkDirty: boolean) => Promise<void>;
|
|
|
|
}
|
2023-09-20 17:24:56 +03:00
|
|
|
export const SaveButton = ({ handleSubmit, ...props }: Props): ReactElement => {
|
2023-08-25 19:37:56 +03:00
|
|
|
const { t } = useTranslation(["translation"]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
variant={"primary"}
|
|
|
|
onClick={() => void handleSubmit(true)}
|
|
|
|
type="button"
|
2023-09-20 17:24:56 +03:00
|
|
|
{...props}
|
2023-08-25 19:37:56 +03:00
|
|
|
>
|
|
|
|
{t("saveButton")}
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
};
|