-
Notifications
You must be signed in to change notification settings - Fork 554
Expand file tree
/
Copy pathChatOverlayLayout.tsx
More file actions
57 lines (53 loc) · 1.44 KB
/
ChatOverlayLayout.tsx
File metadata and controls
57 lines (53 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/** @jsx createElement */
import { cx } from '../../lib';
import type { Renderer } from '../../types';
import type { ChatLayoutOwnProps } from './types';
export function createChatOverlayLayoutComponent({ createElement }: Renderer) {
return function ChatOverlayLayout(userProps: ChatLayoutOwnProps) {
const {
open,
maximized,
headerElement,
messagesElement,
promptElement,
toggleButtonElement,
classNames = {},
// Chat state props (destructured to avoid spreading on div)
messages: _messages,
status: _status,
isClearing: _isClearing,
clearMessages: _clearMessages,
onClearTransitionEnd: _onClearTransitionEnd,
suggestions: _suggestions,
tools: _tools,
...rest
} = userProps;
return (
<div
{...rest}
className={cx(
'ais-Chat',
'ais-ChatOverlayLayout',
maximized && 'ais-ChatOverlayLayout--maximized',
classNames.root
)}
>
<div
className={cx(
'ais-Chat-container',
open && 'ais-Chat-container--open',
maximized && 'ais-Chat-container--maximized',
classNames.container
)}
>
{headerElement}
{messagesElement}
{promptElement}
</div>
<div className="ais-Chat-toggleButtonWrapper">
{toggleButtonElement}
</div>
</div>
);
};
}