mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 07:26:02 +01:00
refactor(web): scale fade transition
This commit is contained in:
22
web/src/transitions/ScaleFade.tsx
Normal file
22
web/src/transitions/ScaleFade.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
||||
const ScaleFade: React.FC<{ visible: boolean; children: React.ReactNode }> = ({ visible, children }) => {
|
||||
return (
|
||||
<>
|
||||
<AnimatePresence initial={false}>
|
||||
{visible && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.95 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.95 }}
|
||||
transition={{ duration: 0.1 }}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ScaleFade;
|
||||
Reference in New Issue
Block a user