@botonic/react
Version:
Build Chatbots using React
19 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SendButton = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importStar(require("react"));
const send_button_svg_1 = tslib_1.__importDefault(require("../../assets/send-button.svg"));
const constants_1 = require("../../constants");
const contexts_1 = require("../../contexts");
const conditional_animation_1 = require("../components/conditional-animation");
const common_1 = require("./common");
const SendButton = ({ onClick }) => {
const { getThemeProperty } = (0, react_1.useContext)(contexts_1.WebchatContext);
const sendButtonEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.enableSendButton, true);
const CustomSendButton = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customSendButton, undefined);
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: sendButtonEnabled || CustomSendButton ? ((0, jsx_runtime_1.jsx)(conditional_animation_1.ConditionalAnimation, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ onClick: onClick, role: constants_1.ROLES.SEND_BUTTON_ICON }, { children: CustomSendButton ? ((0, jsx_runtime_1.jsx)(CustomSendButton, {})) : ((0, jsx_runtime_1.jsx)(common_1.Icon, { src: send_button_svg_1.default })) })) })) : null }));
};
exports.SendButton = SendButton;
//# sourceMappingURL=send-button.js.map