+ {animatedNotifications.map((notification) => (
+
handleRemove(notification.id)}
+ className={`
+ p-2 rounded shadow-md relative transition-all duration-300 max-w-sm
+ transform origin-top pointer-events-auto cursor-pointer
+ ${notification.isExiting ? 'animate-fade-out' : 'animate-slide-in-top'}
+ ${getNotificationClass(notification.type)}
+ `}
+ >
+
{notification.message}
+
+ ))}
+
+ );
+};
+
+const getNotificationClass = (type: 'success' | 'danger' | 'warning' | 'info'): string => {
+ const baseStyle = 'border border-white bg-opacity-70 backdrop-blur-sm';
+
+ switch (type) {
+ case 'success':
+ return `${baseStyle} bg-primary text-white`;
+ case 'danger':
+ return `${baseStyle} bg-primary text-white`;
+ case 'warning':
+ return `${baseStyle} bg-primary text-white`;
+ case 'info':
+ default:
+ return `${baseStyle} bg-primary text-white`;
+ }
+};
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 5d480d9..6ed158b 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,13 +1,33 @@
/** @type {import('tailwindcss').Config} */
export default {
- content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
- theme: {
- extend: {
- colors: {
- gray: "#1d1d1b",
- primary: "#e40615",
- },
+ content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
+ theme: {
+ extend: {
+ colors: {
+ gray: '#1d1d1b',
+ primary: '#e40615',
+ },
+ keyframes: {
+ 'slide-in-top': {
+ '0%': {
+ transform: 'translateY(-1rem)',
+ opacity: '0',
+ },
+ '100%': {
+ transform: 'translateY(0)',
+ opacity: '1',
+ },
+ },
+ 'fade-out': {
+ '0%': { opacity: '1' },
+ '100%': { opacity: '0' },
+ },
+ },
+ animation: {
+ 'slide-in-top': 'slide-in-top 0.3s ease-out forwards',
+ 'fade-out': 'fade-out 0.3s ease-out forwards',
+ },
+ },
},
- },
- plugins: [],
+ plugins: [],
};