/themes-alert-cute

JS library with the purpose of providing success and error alert box messages for your website.

Primary LanguageCSS

Cute Alert

JS library with the purpose of providing success and error alert box messages for your website.

img

Instructions

  • Firstly clone this repo and import both "style.css" and "app.js" into your code. (JS file must be at the end of body tag)
  • In your JS file, call cuteAlert() passing the following arguments: type, title, message and buttonText. (the last one is optional)

Examples:

cuteAlert({
  type: "success",
  title: "Congratulations!",
  message: "You won the match!",
  buttonText: "Yaay!!!"
});
cuteAlert({
  type: "error",
  title: "Sorry...",
  message: "You lost the match!",
  buttonText: "OK :-("
});

cuteAlert() returns a Promise, so you can use "then" to execute an action after the modal window is closed:

cuteAlert({
  type: "error",
  title: "Sorry...",
  message: "You lost the match!",
  buttonText: "OK :-("
}).then(() => {
  location.reload();
});

Design

Dev