This commit is contained in:
Laux Dev
2026-03-06 09:21:17 +08:00
parent 9b23841876
commit c1e11d7f1c

View File

@@ -5,13 +5,19 @@ import SecondaryButton from "../buttons/secondaryButton/SecondaryButton";
import PrimaryButton from "../buttons/primarybutton/PrimaryButton"; import PrimaryButton from "../buttons/primarybutton/PrimaryButton";
const Alert = (props) => { const Alert = (props) => {
const [hide, setHide] = useState(false); const [hide, setHide] = useState(false);
const body = props?.body;
const handleHide = () => { const handleHide = () => {
setHide(true); setHide(true);
setTimeout(() => { setTimeout(() => {
props.setTriggerAlert(false); props.setTriggerAlert(false);
if (props?.editState) { }, 250);
};
const handleConfirm = () => {
setHide(true);
setTimeout(() => {
props.setTriggerAlert(false);
props?.setEditState(false); props?.setEditState(false);
}
}, 250); }, 250);
}; };
return ( return (
@@ -27,17 +33,12 @@ const Alert = (props) => {
</div> </div>
<div className={styles.alertBody}> <div className={styles.alertBody}>
<p> <p>
{props?.body || {body ||
" You are about to add a new record. Please review the details before continuing. Do you want to proceed?"} " You are about to add a new record. Please review the details before continuing. Do you want to proceed?"}
</p> </p>
</div> </div>
<div className={styles.actionButtons}> <div className={styles.actionButtons}>
<PrimaryButton <PrimaryButton text="Confirm" onClick={handleConfirm} />
text="Confirm"
onClick={() => {
handleHide();
}}
/>
<SecondaryButton text="Cancel" onClick={handleHide} /> <SecondaryButton text="Cancel" onClick={handleHide} />
</div> </div>
</div> </div>