@botonic/react
Version:
Build Chatbots using React
24 lines (19 loc) • 618 B
JSX
import React, { useContext } from 'react'
import { WEBCHAT } from '../../constants'
import { Scale } from '../../shared/styles'
import { ConditionalWrapper } from '../../util/react'
import { WebchatContext } from '../context'
export const ConditionalAnimation = props => {
const { getThemeProperty } = useContext(WebchatContext)
const animationsEnabled = getThemeProperty(
WEBCHAT.CUSTOM_PROPERTIES.enableAnimations
)
return (
<ConditionalWrapper
condition={animationsEnabled}
wrapper={children => <Scale>{children}</Scale>}
>
{props.children}
</ConditionalWrapper>
)
}