Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 71 additions & 61 deletions src/components/DialogBox.jsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,79 @@
import React from "react";

const DialogBox = ({
question,
setDialogBoxOpen,
setText,
showAlert,
theme,
setPreviewText,
question,
setDialogBoxOpen,
setText,
showAlert,
theme,
setPreviewText,
setActiveOperation,
}) => {
const handleClear = () => {
setText("");
setPreviewText("");
setDialogBoxOpen(false);
if (showAlert) {
showAlert("Cleared the text.", "success");
}
};
const handleClear = () => {
setText("");
setPreviewText("");
setDialogBoxOpen(false);
if (setActiveOperation) {
setActiveOperation(null);
}
if (showAlert) {
showAlert("Cleared the text.", "success");
}
};

const handleCancel = () => {
setDialogBoxOpen(false);
};
const handleCancel = () => {
setDialogBoxOpen(false);
if (setActiveOperation) {
setActiveOperation(null);
}
};

return (
<div
className="fixed flex justify-center items-center z-[9999]"
style={{
top: 0,
left: 0,
right: 0,
bottom: 0,
width: "100vw",
backgroundColor:
theme === "light" ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.7)",
}}
>
<div
className="w-[90%] max-w-[400px] p-5 rounded-lg shadow-md"
style={{
backgroundColor: theme === "light" ? "white" : "#313131",
color: theme === "light" ? "black" : "white",
border: theme === "light" ? "0px solid black" : "0px solid grey",
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
}}
>
<h5 className="text-lg font-medium mb-3">Clear Text</h5>
<p className="mb-4">{question}</p>
<div className="flex justify-end gap-2">
<button
type="button"
className="px-3 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-opacity-50"
onClick={handleCancel}
>
Cancel
</button>
<button
type="button"
className="px-3 py-2 bg-red-600 text-white rounded hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-600 focus:ring-opacity-50"
onClick={handleClear}
>
Clear
</button>
return (
<div
className="fixed flex justify-center items-center z-[9999]"
style={{
top: 0,
left: 0,
right: 0,
bottom: 0,
width: "100vw",
backgroundColor:
theme === "light"
? "rgba(0, 0, 0, 0.5)"
: "rgba(0, 0, 0, 0.7)",
}}
>
<div
className="w-[90%] max-w-[400px] p-5 rounded-lg shadow-md"
style={{
backgroundColor: theme === "light" ? "white" : "#313131",
color: theme === "light" ? "black" : "white",
border:
theme === "light"
? "0px solid black"
: "0px solid grey",
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
}}
>
<h5 className="text-lg font-medium mb-3">Clear Text</h5>
<p className="mb-4">{question}</p>
<div className="flex justify-end gap-2">
<button
type="button"
className="px-3 py-2 bg-gray-500 text-white rounded hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-opacity-50 cursor-pointer"
onClick={handleCancel}
>
Cancel
</button>
<button
type="button"
className="px-3 py-2 bg-red-600 text-white rounded hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-600 focus:ring-opacity-50 cursor-pointer"
onClick={handleClear}
>
Clear
</button>
</div>
</div>
</div>
</div>
</div>
);
);
};

export default DialogBox;
Loading