* fix: prevent textarea resize overlapping buttons in rejection dialog The rejection reason textarea in the booking rejection dialog allows manual resizing via the drag handle, which can cause it to expand over the dialog footer buttons. Adding resize-none prevents this overlap. Fixes #17536 * Update RejectionReasonDialog.tsx --------- Co-authored-by: Sahitya Chandra <sahityajb@gmail.com>
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import type { Dispatch, SetStateAction } from "react";
|
|
import { useState, useEffect } from "react";
|
|
|
|
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Button } from "@calcom/ui/components/button";
|
|
import { DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog";
|
|
import { TextAreaField } from "@calcom/ui/components/form";
|
|
|
|
interface RejectionReasonDialogProps {
|
|
isOpenDialog: boolean;
|
|
setIsOpenDialog: Dispatch<SetStateAction<boolean>>;
|
|
onConfirm: (reason: string) => void;
|
|
isPending?: boolean;
|
|
}
|
|
|
|
export function RejectionReasonDialog({
|
|
isOpenDialog,
|
|
setIsOpenDialog,
|
|
onConfirm,
|
|
isPending = false,
|
|
}: RejectionReasonDialogProps) {
|
|
const { t } = useLocale();
|
|
const [rejectionReason, setRejectionReason] = useState("");
|
|
|
|
useEffect(() => {
|
|
if (!isOpenDialog) {
|
|
setRejectionReason("");
|
|
}
|
|
}, [isOpenDialog]);
|
|
|
|
const handleConfirm = () => {
|
|
onConfirm(rejectionReason);
|
|
};
|
|
|
|
return (
|
|
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
|
|
<DialogContent
|
|
title={t("rejection_reason_title")}
|
|
description={t("rejection_reason_description")}
|
|
enableOverflow>
|
|
<div className="min-h-0 max-h-[40vh] overflow-y-auto">
|
|
<TextAreaField
|
|
name="rejectionReason"
|
|
label={
|
|
<>
|
|
{t("rejection_reason")}
|
|
<span className="text-subtle font-normal"> ({t("optional")})</span>
|
|
</>
|
|
}
|
|
value={rejectionReason}
|
|
onChange={(e) => setRejectionReason(e.target.value)}
|
|
/>
|
|
</div>
|
|
|
|
<DialogFooter noSticky>
|
|
<DialogClose color="secondary" />
|
|
<Button disabled={isPending} data-testid="rejection-confirm" onClick={handleConfirm}>
|
|
{t("rejection_confirmation")}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|