mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 15:02:37 +10:00
* fix: add cancel button for editing comments * cleanup --------- Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
35 lines
745 B
TypeScript
35 lines
745 B
TypeScript
import { Button, Group } from "@mantine/core";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type CommentActionsProps = {
|
|
onSave: () => void;
|
|
isLoading?: boolean;
|
|
onCancel?: () => void;
|
|
isCommentEditor?: boolean;
|
|
};
|
|
|
|
function CommentActions({
|
|
onSave,
|
|
isLoading,
|
|
onCancel,
|
|
isCommentEditor,
|
|
}: CommentActionsProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Group justify="flex-end" pt="sm" wrap="nowrap">
|
|
{isCommentEditor && (
|
|
<Button size="compact-sm" variant="default" onClick={onCancel}>
|
|
{t("Cancel")}
|
|
</Button>
|
|
)}
|
|
|
|
<Button size="compact-sm" loading={isLoading} onClick={onSave}>
|
|
{t("Save")}
|
|
</Button>
|
|
</Group>
|
|
);
|
|
}
|
|
|
|
export default CommentActions;
|