summaryrefslogtreecommitdiff
path: root/src/components/ui/AnimateOnLoad.jsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-05-22 15:51:50 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-05-22 15:51:50 +0700
commit8080c415e466ce29d0f7c29284c3a8537c6b237d (patch)
tree6c98a85efa39b63a7c13d0051fb48abb5e7711d0 /src/components/ui/AnimateOnLoad.jsx
parentdfe8b63a901350aee7d9024524bc50529159b8b9 (diff)
add animate on load for smooth render
Diffstat (limited to 'src/components/ui/AnimateOnLoad.jsx')
-rw-r--r--src/components/ui/AnimateOnLoad.jsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/components/ui/AnimateOnLoad.jsx b/src/components/ui/AnimateOnLoad.jsx
new file mode 100644
index 00000000..fb9919e1
--- /dev/null
+++ b/src/components/ui/AnimateOnLoad.jsx
@@ -0,0 +1,25 @@
+import classNames from 'classnames'
+import { motion } from 'framer-motion'
+
+/**
+ * Animate On Load
+ * @param {object} props
+ * @param {string} props.className - Container class
+ */
+const AnimateOnLoad = (props) => {
+ const { className: propsClassName, children } = props
+
+ const combinedClassName = classNames(propsClassName)
+
+ return (
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1, transition: { duration: 0.3 } }}
+ className={combinedClassName}
+ >
+ {children}
+ </motion.div>
+ )
+}
+
+export default AnimateOnLoad