UNPKG

@botonic/react

Version:

Build Chatbots using React

20 lines 1.05 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef, useContext } from 'react'; import { WEBCHAT } from '../../constants'; import { WebchatContext } from '../../webchat/context'; import { BotonicContainerId } from '../constants'; import { DefaultHeader } from './default-header'; import { StyledWebchatHeader } from './styles'; export const WebchatHeader = forwardRef((_, ref) => { const { getThemeProperty, toggleWebchat } = useContext(WebchatContext); const handleCloseWebchat = () => { toggleWebchat(false); }; const CustomHeader = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.customHeader); if (CustomHeader) { return (_jsx("div", Object.assign({ id: BotonicContainerId.Header, ref: ref }, { children: _jsx(CustomHeader, { onCloseClick: handleCloseWebchat }) }))); } return (_jsx(StyledWebchatHeader, Object.assign({ id: BotonicContainerId.Header, ref: ref }, { children: _jsx(DefaultHeader, {}) }))); }); WebchatHeader.displayName = 'WebchatHeader'; //# sourceMappingURL=index.js.map