UNPKG

@botonic/react

Version:

Build Chatbots using React

18 lines 1.24 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { useContext } from 'react'; import { WEBCHAT } from '../../constants'; import { Fade } from '../../shared/styles'; import { resolveImage } from '../../util/environment'; import { ConditionalWrapper } from '../../util/react'; import { WebchatContext } from '../../webchat/context'; import { DefaultIntroImage } from './styles'; export const IntroMessage = () => { const { getThemeProperty } = useContext(WebchatContext); const animationsEnabled = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.enableAnimations); const CustomIntro = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.customIntro); const introImage = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.introImage); const introStyle = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.introStyle); const DefaultIntro = introImage && (_jsx(DefaultIntroImage, { style: Object.assign({}, introStyle), src: resolveImage(introImage) })); return CustomIntro || DefaultIntro ? (_jsx(ConditionalWrapper, Object.assign({ condition: animationsEnabled, wrapper: children => _jsx(Fade, { children: children }) }, { children: CustomIntro ? _jsx(CustomIntro, {}) : DefaultIntro }))) : null; }; //# sourceMappingURL=intro-message.js.map