1- import React , { useState , useEffect } from 'react' ;
1+ import React , { useEffect } from 'react' ;
2+ import { motion } from 'framer-motion' ;
23
34import { X } from '@phosphor-icons/react' ;
45
@@ -14,9 +15,13 @@ const Toast = ({ title, message, duration, onClose }) => {
1415 } , [ duration , onClose ] ) ;
1516
1617 return (
17- < div
18- className = "fixed top-28 left-1/2 -translate-x-1/2 text-gray-300 py-4 px-10 rounded-lg shadow-lg border backdrop-blur-sm flex items-center justify-between w-96"
19- style = { { backgroundColor : 'rgba(68, 64, 59, 0.65)' , borderColor : '#5a5e64' } }
18+ < motion . div
19+ initial = { { y : - 100 , opacity : 0 } }
20+ animate = { { y : 0 , opacity : 1 } }
21+ exit = { { y : - 100 , opacity : 0 } }
22+ transition = { { type : 'spring' , stiffness : 120 , damping : 20 } }
23+ className = "fixed top-28 -translate-y-1/2 left-0 right-0 mx-auto text-gray-300 py-4 px-10 rounded-lg shadow-lg border backdrop-blur-sm flex items-center justify-between w-96"
24+ style = { { backgroundColor : 'rgba(68, 64, 59, 0.8)' , borderColor : '#5a5e64' } }
2025 >
2126 < div className = "flex flex-col text-sm" >
2227 < span > { title } </ span >
@@ -25,7 +30,7 @@ const Toast = ({ title, message, duration, onClose }) => {
2530 < button onClick = { onClose } className = "pr-2" >
2631 < X size = { 24 } weight = "bold" />
2732 </ button >
28- </ div >
33+ </ motion . div >
2934 ) ;
3035} ;
3136
0 commit comments