Sweet Alert
Installation
npm i @sweetalert/with-react
Script
import Swal from "sweetalert2";
import "sweetalert2/src/sweetalert2.scss";
const MovieList = memo(() => {
const cartSwal = () => {
Swal.fire({
title: `${t("sweetalert.added")}`,
text: `${t("sweetalert.added_to_cart")}`,
icon: "success",
confirmButtonText: `${t("sweetalert.ok_btn")}`,
background: "#141314",
color: "#ffffff",
});
};
retutn(
<>
<div className="iq-button">
<Link
to="#"
className="btn btn-sm cart-btn text-uppercase position-relative"
onClick={cartSwal}
>
<span className="button-text">
{t("shop.add_to_cart")}
</span>
<i className="fa-solid fa-play"></i>
</Link>
</div>
</>
)
}