ActuallyCookie commited on
Commit
c9767fa
·
verified ·
1 Parent(s): 582ba4d

Upload components/AlertContainer.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/AlertContainer.jsx +29 -0
components/AlertContainer.jsx ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { AnimatePresence } from 'framer-motion';
2
+ import AlertCard from './AlertCard';
3
+
4
+ const containerPositions = {
5
+ 'top-left': 'fixed top-6 left-6 z-[9999]',
6
+ 'top-center': 'fixed top-6 left-1/2 -translate-x-1/2 z-[9999]',
7
+ 'top-right': 'fixed top-6 right-6 z-[9999]',
8
+ 'bottom-left': 'fixed bottom-6 left-6 z-[9999]',
9
+ 'bottom-center': 'fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999]',
10
+ 'bottom-right': 'fixed bottom-6 right-6 z-[9999]',
11
+ 'center': 'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[9999]',
12
+ };
13
+
14
+ export default function AlertContainer({ alerts, position, onDismiss }) {
15
+ return (
16
+ <div className={`${containerPositions[position] || containerPositions['top-right']} flex flex-col gap-3 w-full max-w-sm`}>
17
+ <AnimatePresence mode="popLayout">
18
+ {alerts.map((alert) => (
19
+ <AlertCard
20
+ key={alert.id}
21
+ {...alert}
22
+ position={position}
23
+ onDismiss={onDismiss}
24
+ />
25
+ ))}
26
+ </AnimatePresence>
27
+ </div>
28
+ );
29
+ }