summaryrefslogtreecommitdiff
path: root/src/components/ui/AnimateOnLoad.jsx
blob: fb9919e1da868af76738ac6f312c51190e723e07 (plain)
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
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