UNPKG

@botonic/react

Version:

Build Chatbots using React

21 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PersistentMenu = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); /** biome-ignore-all lint/a11y/noStaticElementInteractions: we need to use static elements for the persistent menu */ /** biome-ignore-all lint/a11y/useKeyWithClickEvents: we need to use key with click events for the persistent menu */ const react_1 = require("react"); const menuButton_svg_1 = tslib_1.__importDefault(require("../../assets/menuButton.svg")); const constants_1 = require("../../constants"); const context_1 = require("../../webchat/context"); const common_1 = require("../components/common"); const conditional_animation_1 = require("../components/conditional-animation"); const PersistentMenu = ({ onClick }) => { const { webchatState } = (0, react_1.useContext)(context_1.WebchatContext); const persistentMenuOptions = webchatState.theme.userInput?.persistentMenu; const CustomMenuButton = webchatState.theme.userInput?.menuButton?.custom; return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: persistentMenuOptions ? ((0, jsx_runtime_1.jsx)(conditional_animation_1.ConditionalAnimation, { children: (0, jsx_runtime_1.jsx)("div", { role: constants_1.ROLES.PERSISTENT_MENU_ICON, onClick: onClick, children: CustomMenuButton ? (0, jsx_runtime_1.jsx)(CustomMenuButton, {}) : (0, jsx_runtime_1.jsx)(common_1.Icon, { src: menuButton_svg_1.default }) }) })) : null })); }; exports.PersistentMenu = PersistentMenu; //# sourceMappingURL=persistent-menu.js.map