UNPKG

@servicetitan/assist-ui

Version:

ServiceTitan Assist UI Components

15 lines 649 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect, useRef } from 'react'; import * as styles from './content.module.less'; export const Content = ({ children, messages }) => { const chatEndRef = useRef(null); const scrollToBottom = () => { var _a; (_a = chatEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' }); }; useEffect(() => { scrollToBottom(); }, [messages.length]); return (_jsxs("div", { className: styles.chatContent, children: [children, _jsx("div", { ref: chatEndRef })] })); }; //# sourceMappingURL=content.js.map