fix: add cancel button for editing comments (#580)

* fix: add cancel button for editing comments

* cleanup

---------

Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
This commit is contained in:
Naifer
2025-01-15 17:37:57 +01:00
committed by GitHub
parent f7efb6c2c9
commit 71cfe3cd8e
2 changed files with 21 additions and 3 deletions

View File

@ -4,13 +4,26 @@ import { useTranslation } from "react-i18next";
type CommentActionsProps = {
onSave: () => void;
isLoading?: boolean;
onCancel?: () => void;
isCommentEditor?: boolean;
};
function CommentActions({ onSave, isLoading }: CommentActionsProps) {
function CommentActions({
onSave,
isLoading,
onCancel,
isCommentEditor,
}: CommentActionsProps) {
const { t } = useTranslation();
return (
<Group justify="flex-end" pt={2} wrap="nowrap">
<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>