cart: Special request > move files

This commit is contained in:
2025-10-09 18:10:02 +03:00
parent 905367899e
commit 7c027b2114
7 changed files with 24 additions and 19 deletions

View File

@@ -1,68 +0,0 @@
import { Button, Input } from "antd";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet";
const { TextArea } = Input;
interface SpecialRequestBottomSheetProps {
isOpen: boolean;
onClose: () => void;
initialValue: string;
onSave: (value: string) => void;
}
export function SpecialRequestBottomSheet({
isOpen,
onClose,
initialValue,
onSave,
}: SpecialRequestBottomSheetProps) {
const { t } = useTranslation();
const [value, setValue] = useState(initialValue);
useEffect(() => {
setValue(initialValue);
}, [initialValue]);
const handleSave = () => {
onSave(value);
onClose();
};
const handleCancel = () => {
setValue(initialValue);
onClose();
};
return (
<ProBottomSheet
isOpen={isOpen}
onClose={handleCancel}
title={t("cart.specialRequest")}
showCloseButton={false}
initialSnap={1}
height={"40vh"}
snapPoints={["30vh"]}
>
<div className="space-y-4">
<div>
<TextArea
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder={t("cart.specialRequest")}
rows={6}
size="middle"
autoFocus={false}
/>
</div>
<br />
<Button type="primary" style={{ width: "100%" }} onClick={handleSave}>
{t("cart.save")}
</Button>
</div>
</ProBottomSheet>
);
}

View File

@@ -1,66 +0,0 @@
import { Button, Input, Modal } from "antd";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
const { TextArea } = Input;
interface SpecialRequestDialogProps {
isOpen: boolean;
onClose: () => void;
initialValue: string;
onSave: (value: string) => void;
}
export function SpecialRequestDialog({
isOpen,
onClose,
initialValue,
onSave,
}: SpecialRequestDialogProps) {
const { t } = useTranslation();
const [value, setValue] = useState(initialValue);
useEffect(() => {
setValue(initialValue);
}, [initialValue]);
const handleSave = () => {
onSave(value);
onClose();
};
const handleCancel = () => {
setValue(initialValue);
onClose();
};
return (
<Modal
title={t("cart.specialRequest")}
open={isOpen}
onCancel={handleCancel}
footer={[
<Button key="cancel" onClick={handleCancel}>
{t("cart.cancel")}
</Button>,
<Button key="save" type="primary" onClick={handleSave}>
{t("cart.save")}
</Button>,
]}
width={500}
destroyOnHidden
>
<div className="space-y-4">
<div>
<TextArea
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder={t("cart.specialRequest")}
rows={6}
autoFocus={false}
/>
</div>
</div>
</Modal>
);
}