Spaces:
Runtime error
Runtime error
File size: 618 Bytes
cd6f98e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import { motion } from "framer-motion";
import type { PropsWithChildren } from "react";
interface MotionProps extends PropsWithChildren {
showComponent: boolean;
className?: string;
}
const HideShow = (props: MotionProps) => {
const { showComponent, ...rest } = props;
return (
<motion.span
animate={showComponent ? "show" : "hide"}
variants={{
show: { opacity: 1, visibility: "visible" },
hide: { opacity: 0, visibility: "hidden" },
}}
{...rest}
>
{props.children}
</motion.span>
);
};
HideShow.displayName = "HideShow";
export default HideShow;
|