UNPKG

@botonic/react

Version:

Build Chatbots using React

23 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebchatHeader = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const constants_1 = require("../../constants"); const context_1 = require("../../webchat/context"); const constants_2 = require("../constants"); const default_header_1 = require("./default-header"); const styles_1 = require("./styles"); exports.WebchatHeader = (0, react_1.forwardRef)((_, ref) => { const { getThemeProperty, toggleWebchat } = (0, react_1.useContext)(context_1.WebchatContext); const handleCloseWebchat = () => { toggleWebchat(false); }; const CustomHeader = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customHeader); if (CustomHeader) { return ((0, jsx_runtime_1.jsx)("div", Object.assign({ id: constants_2.BotonicContainerId.Header, ref: ref }, { children: (0, jsx_runtime_1.jsx)(CustomHeader, { onCloseClick: handleCloseWebchat }) }))); } return ((0, jsx_runtime_1.jsx)(styles_1.StyledWebchatHeader, Object.assign({ id: constants_2.BotonicContainerId.Header, ref: ref }, { children: (0, jsx_runtime_1.jsx)(default_header_1.DefaultHeader, {}) }))); }); exports.WebchatHeader.displayName = 'WebchatHeader'; //# sourceMappingURL=index.js.map