diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ColorsSelected.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ColorsSelected.jsx new file mode 100644 index 0000000..92a4acb --- /dev/null +++ b/src/Pages/BookingScreen/Components/UtillComponents/ColorsSelected.jsx @@ -0,0 +1,130 @@ +import { Modal } from "antd"; +import { CloseOutlined, PlusOutlined } from "@ant-design/icons"; +import { SwatchesPicker } from "react-color"; +import { useEffect, useState } from "react"; +import Buttons from "../../../../Components/Forms/Buttons"; + +const ColorsSelected = ({ open, onClose, onSave, initial = {} }) => { + const [colorType, setColorType] = useState("background"); + const [bgColor, setBgColor] = useState(initial.background || "#ffffff"); + const [fontColor, setFontColor] = useState(initial.font || "#000000" ); + + // reset when modal is opened with different initial colors + useEffect(() => { + if (initial.background) setBgColor(initial.background); + if (initial.font) setFontColor(initial.font); + }, [initial, open]); + + const handleColorChange = (color) => { + if (colorType === "background") { + setBgColor(color.hex); + } else { + setFontColor(color.hex); + } + }; + + const handleSave = () => { + onSave({ + background: bgColor, + font: fontColor, + }); + onClose(); + }; + + return ( + } + footer={null} + width={400} + > + + + {/* ✅ Selected Color Preview */} +
+
+ {/* Background Preview */} +
setColorType("background")} + style={{ + cursor: "pointer", + padding: "5px", + borderRadius: "6px", + border: + colorType === "background" + ? "2px solid #901D77" + : "1px solid transparent", + }} + > +

+ Background +

+
+
+ + {/* Font Preview */} +
setColorType("font")} + style={{ + cursor: "pointer", + padding: "5px", + borderRadius: "6px", + border: + colorType === "font" + ? "2px solid #901D77" + : "1px solid transparent", + }} + > +

+ Font +

+
+
+
+
+ + {/* Color Picker */} + + + + + ); +}; + +export default ColorsSelected; \ No newline at end of file