p]:max-w-full
[&>p]:m-0
-`;
+ mb-3
+`}
+ onClick={ereaseAlert}
+ >
+ {children}
+
+);
type AlertProps = {
message?: string;
+ animation: string;
+ deleteAlert: () => void;
+ icon: ReactNode;
};
-const AlertSuccess = ({ message = 'Changes Saved Successfully' }: AlertProps) => (
-
+ {activeAlerts.map((alert) => (
+
deleteAlerts(alert.id)}
+ icon={
+ alert.isSuccess ? (
+
+ ) : (
+
+ )
+ }
+ />
+ ))}
+ ,
+ document.body,
);
};
diff --git a/src/resources/global.css b/src/resources/global.css
index 183f1c2..4405109 100644
--- a/src/resources/global.css
+++ b/src/resources/global.css
@@ -74,6 +74,37 @@
}
}
+
+ .alert-only-fade-in {
+ @keyframes fadeIn {
+ 0% {
+ transform: translateY(-40px);
+ visibility: visible;
+ opacity: 0;
+ }
+ 100% {
+ transform: translateY(0px);
+ visibility: visible;
+ opacity: 1;
+ }
+ }
+ }
+
+ .alert-only-fade-out {
+ @keyframes fadeOut {
+ 0% {
+ transform: translateY(0px);
+ visibility: visible;
+ opacity: 1;
+ }
+ 100% {
+ transform: translateY(-40px);
+ visibility: hidden;
+ opacity: 0;
+ }
+ }
+ }
+
.animated-menu {
-webkit-animation-duration: 600ms;
animation-duration: 600ms;
diff --git a/src/useAlertStore.ts b/src/useAlertStore.ts
index c754be0..5d5e3c9 100644
--- a/src/useAlertStore.ts
+++ b/src/useAlertStore.ts
@@ -1,19 +1,28 @@
import { create } from 'zustand';
+import { Alert } from './Alert';
-interface AlertState {
- message?: string;
- isSuccess?: boolean;
- setAlert: (isSuccess: boolean, message?: string) => void;
+interface Alert {
+ id: number;
+ message: string;
+ isSuccess: boolean;
+ isTimed: boolean;
}
-export default create