@servicetitan/assist-ui
Version:
ServiceTitan Assist UI Components
23 lines • 1.55 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { observer } from 'mobx-react';
import IconSend from '@servicetitan/anvil2/assets/icons/material/round/send.svg';
import { TextField, Text, Link } from '@servicetitan/anvil2';
import classNames from 'classnames';
import * as styles from './footer.module.less';
export const Footer = observer(({ isLoading = false, placeholder = 'Ask Assist', message, onMessageChange, onSubmit, className, }) => {
const handleKeydown = (event) => {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault();
if (!isLoading) {
onSubmit();
}
}
};
const handleSubmit = () => {
if (!isLoading) {
onSubmit();
}
};
return (_jsxs("form", { className: classNames(styles.chatFooter, className), children: [_jsx(TextField, { flexGrow: 1, size: "large", onChange: e => onMessageChange(e.target.value), value: message, placeholder: placeholder, name: "message-input", onKeyDown: handleKeydown, suffix: _jsx(IconSend, { width: 16, height: 16, style: { cursor: 'pointer' }, onClick: handleSubmit }) }), _jsxs(Text, { subdued: true, variant: "body", size: "small", className: styles.chatFooterDescription, children: ["Assist is AI-powered and can make mistakes.", ' ', _jsx(Link, { target: "_blank", href: "#", appearance: "secondary", children: _jsx(Text, { inline: true, size: "small", subdued: true, children: "Learn more" }) })] })] }));
});
//# sourceMappingURL=footer.js.map