mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
chore: formatting
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
AnimatePresence as PrimitiveAnimatePresence,
|
||||
motion,
|
||||
useReducedMotion,
|
||||
AnimatePresence as PrimitiveAnimatePresence,
|
||||
motion,
|
||||
useReducedMotion,
|
||||
} from "framer-motion";
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
@@ -12,56 +12,56 @@ const FadeInStaggerContext = createContext(false);
|
||||
const viewport = { once: true, margin: "0px 0px -200px" };
|
||||
|
||||
export const FadeIn = (
|
||||
props: React.ComponentPropsWithoutRef<typeof motion.div> & {
|
||||
fromTopToBottom?: boolean;
|
||||
},
|
||||
props: React.ComponentPropsWithoutRef<typeof motion.div> & {
|
||||
fromTopToBottom?: boolean;
|
||||
},
|
||||
) => {
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
const isInStaggerGroup = useContext(FadeInStaggerContext);
|
||||
const shouldReduceMotion = useReducedMotion();
|
||||
const isInStaggerGroup = useContext(FadeInStaggerContext);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
variants={{
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
y: shouldReduceMotion ? 0 : props.fromTopToBottom ? -24 : 2,
|
||||
},
|
||||
visible: { opacity: 1, y: 0 },
|
||||
}}
|
||||
transition={{ duration: 0.3 }}
|
||||
{...(isInStaggerGroup
|
||||
? {}
|
||||
: {
|
||||
initial: "hidden",
|
||||
whileInView: "visible",
|
||||
viewport,
|
||||
})}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<motion.div
|
||||
variants={{
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
y: shouldReduceMotion ? 0 : props.fromTopToBottom ? -24 : 2,
|
||||
},
|
||||
visible: { opacity: 1, y: 0 },
|
||||
}}
|
||||
transition={{ duration: 0.3 }}
|
||||
{...(isInStaggerGroup
|
||||
? {}
|
||||
: {
|
||||
initial: "hidden",
|
||||
whileInView: "visible",
|
||||
viewport,
|
||||
})}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const FadeInStagger = ({
|
||||
faster = false,
|
||||
...props
|
||||
faster = false,
|
||||
...props
|
||||
}: React.ComponentPropsWithoutRef<typeof motion.div> & {
|
||||
faster?: boolean;
|
||||
faster?: boolean;
|
||||
}) => {
|
||||
return (
|
||||
<FadeInStaggerContext.Provider value={true}>
|
||||
<motion.div
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={viewport}
|
||||
transition={{ staggerChildren: faster ? 0.08 : 0.2 }}
|
||||
{...props}
|
||||
/>
|
||||
</FadeInStaggerContext.Provider>
|
||||
);
|
||||
return (
|
||||
<FadeInStaggerContext.Provider value={true}>
|
||||
<motion.div
|
||||
initial="hidden"
|
||||
whileInView="visible"
|
||||
viewport={viewport}
|
||||
transition={{ staggerChildren: faster ? 0.08 : 0.2 }}
|
||||
{...props}
|
||||
/>
|
||||
</FadeInStaggerContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const AnimatePresence = (
|
||||
props: React.ComponentPropsWithoutRef<typeof PrimitiveAnimatePresence>,
|
||||
props: React.ComponentPropsWithoutRef<typeof PrimitiveAnimatePresence>,
|
||||
) => {
|
||||
return <PrimitiveAnimatePresence {...props} />;
|
||||
return <PrimitiveAnimatePresence {...props} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user