UNPKG

@botonic/react

Version:

Build Chatbots using React

15 lines 1.21 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import { useContext } from 'react'; import SendButtonIcon from '../../assets/send-button.svg'; import { ROLES } from '../../constants'; import { WebchatContext } from '../../webchat/context'; import { Icon } from '../components/common'; import { ConditionalAnimation } from '../components/conditional-animation'; export const SendButton = ({ onClick }) => { var _a, _b, _c, _d; const { webchatState } = useContext(WebchatContext); const sendButtonEnabled = (_b = (_a = webchatState.theme.userInput) === null || _a === void 0 ? void 0 : _a.sendButton) === null || _b === void 0 ? void 0 : _b.enable; const CustomSendButton = (_d = (_c = webchatState.theme.userInput) === null || _c === void 0 ? void 0 : _c.sendButton) === null || _d === void 0 ? void 0 : _d.custom; return (_jsx(_Fragment, { children: sendButtonEnabled || CustomSendButton ? (_jsx(ConditionalAnimation, { children: _jsx("div", Object.assign({ onClick: onClick, role: ROLES.SEND_BUTTON_ICON }, { children: CustomSendButton ? (_jsx(CustomSendButton, {})) : (_jsx(Icon, { src: SendButtonIcon })) })) })) : null })); }; //# sourceMappingURL=send-button.js.map