UNPKG

@botonic/react

Version:

Build Chatbots using React

15 lines 1.14 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import { useContext } from 'react'; import LogoMenu from '../../assets/menuButton.svg'; import { ROLES } from '../../constants'; import { WebchatContext } from '../../webchat/context'; import { Icon } from '../components/common'; import { ConditionalAnimation } from '../components/conditional-animation'; export const PersistentMenu = ({ onClick }) => { var _a, _b, _c; const { webchatState } = useContext(WebchatContext); const persistentMenuOptions = (_a = webchatState.theme.userInput) === null || _a === void 0 ? void 0 : _a.persistentMenu; const CustomMenuButton = (_c = (_b = webchatState.theme.userInput) === null || _b === void 0 ? void 0 : _b.menuButton) === null || _c === void 0 ? void 0 : _c.custom; return (_jsx(_Fragment, { children: persistentMenuOptions ? (_jsx(ConditionalAnimation, { children: _jsx("div", Object.assign({ role: ROLES.PERSISTENT_MENU_ICON, onClick: onClick }, { children: CustomMenuButton ? _jsx(CustomMenuButton, {}) : _jsx(Icon, { src: LogoMenu }) })) })) : null })); }; //# sourceMappingURL=persistent-menu.js.map