feat(backend): switch to toasts for client-side API feedback, flesh out edit profile page
This commit is contained in:
parent
8ab4c2a91b
commit
373ccf4b63
6 changed files with 77 additions and 29 deletions
29
frontend/lib/toast.ts
Normal file
29
frontend/lib/toast.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import Toastify from "toastify-js";
|
||||
import "toastify-js/src/toastify.css";
|
||||
|
||||
export default function toast(options: { text: string; background?: string }) {
|
||||
let background: string;
|
||||
switch (options.background) {
|
||||
case "error":
|
||||
background = "#A1081F";
|
||||
break;
|
||||
case "success":
|
||||
background = "#1D611A";
|
||||
break;
|
||||
default:
|
||||
background = "#4F5859";
|
||||
break;
|
||||
}
|
||||
|
||||
Toastify({
|
||||
text: options.text,
|
||||
gravity: "top",
|
||||
position: "left",
|
||||
duration: -1,
|
||||
close: true,
|
||||
style: {
|
||||
background: background,
|
||||
color: "#FFFFFF",
|
||||
},
|
||||
}).showToast();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue