anycoder-6a1e4b3a / components /AlertContainer.jsx
ActuallyCookie's picture
Upload components/AlertContainer.jsx with huggingface_hub
c9767fa verified
Raw History Blame Contribute Delete
1.03 kB
import { AnimatePresence } from 'framer-motion';
import AlertCard from './AlertCard';
const containerPositions = {
'top-left': 'fixed top-6 left-6 z-[9999]',
'top-center': 'fixed top-6 left-1/2 -translate-x-1/2 z-[9999]',
'top-right': 'fixed top-6 right-6 z-[9999]',
'bottom-left': 'fixed bottom-6 left-6 z-[9999]',
'bottom-center': 'fixed bottom-6 left-1/2 -translate-x-1/2 z-[9999]',
'bottom-right': 'fixed bottom-6 right-6 z-[9999]',
'center': 'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[9999]',
};
export default function AlertContainer({ alerts, position, onDismiss }) {
return (
<div className={`${containerPositions[position] || containerPositions['top-right']} flex flex-col gap-3 w-full max-w-sm`}>
<AnimatePresence mode="popLayout">
{alerts.map((alert) => (
<AlertCard
key={alert.id}
{...alert}
position={position}
onDismiss={onDismiss}
/>
))}
</AnimatePresence>
</div>
);
}