|
1 | 1 | import React from 'react'; |
| 2 | +import { ChatWindow } from '@lg-chat/chat-window'; |
| 3 | +import { InputBar } from '@lg-chat/input-bar'; |
| 4 | +import { |
| 5 | + LeafyGreenChatProvider, |
| 6 | + Variant, |
| 7 | +} from '@lg-chat/leafygreen-chat-provider'; |
| 8 | +import { Message } from '@lg-chat/message'; |
| 9 | +import { MessageFeed } from '@lg-chat/message-feed'; |
| 10 | +import { TitleBar } from '@lg-chat/title-bar'; |
2 | 11 | import { StoryMetaType } from '@lg-tools/storybook-utils'; |
3 | 12 | import { StoryFn, StoryObj } from '@storybook/react'; |
4 | 13 |
|
5 | | -import { ChatLayout, type ChatLayoutProps } from '.'; |
| 14 | +import { css } from '@leafygreen-ui/emotion'; |
| 15 | + |
| 16 | +import { ChatLayout, type ChatLayoutProps, ChatMain } from '.'; |
6 | 17 |
|
7 | 18 | const meta: StoryMetaType<typeof ChatLayout> = { |
8 | 19 | title: 'Composition/Chat/ChatLayout', |
9 | 20 | component: ChatLayout, |
10 | 21 | parameters: { |
11 | 22 | default: 'LiveExample', |
12 | 23 | }, |
| 24 | + decorators: [ |
| 25 | + Story => ( |
| 26 | + <div |
| 27 | + style={{ |
| 28 | + margin: '-100px', |
| 29 | + height: '100vh', |
| 30 | + width: '100vw', |
| 31 | + }} |
| 32 | + > |
| 33 | + <Story /> |
| 34 | + </div> |
| 35 | + ), |
| 36 | + ], |
13 | 37 | }; |
14 | 38 | export default meta; |
15 | 39 |
|
16 | | -const Template: StoryFn<ChatLayoutProps> = props => <ChatLayout {...props} />; |
| 40 | +const sideNavPlaceholderStyles = css` |
| 41 | + background-color: rgba(0, 0, 0, 0.05); |
| 42 | + padding: 16px; |
| 43 | + min-width: 200px; |
| 44 | +`; |
| 45 | + |
| 46 | +const testMessages = [ |
| 47 | + { |
| 48 | + id: '1', |
| 49 | + messageBody: 'Hello! How can I help you today?', |
| 50 | + isSender: false, |
| 51 | + }, |
| 52 | + { |
| 53 | + id: '2', |
| 54 | + messageBody: 'I need help with my database query.', |
| 55 | + }, |
| 56 | + { |
| 57 | + id: '3', |
| 58 | + messageBody: |
| 59 | + 'Sure! I can help with that. What specific issue are you encountering?', |
| 60 | + isSender: false, |
| 61 | + }, |
| 62 | +]; |
| 63 | + |
| 64 | +const Template: StoryFn<ChatLayoutProps> = props => ( |
| 65 | + <LeafyGreenChatProvider variant={Variant.Compact}> |
| 66 | + <ChatLayout {...props}> |
| 67 | + <div className={sideNavPlaceholderStyles}>ChatSideNav Placeholder</div> |
| 68 | + <ChatMain> |
| 69 | + <TitleBar title="Chat Assistant" /> |
| 70 | + <ChatWindow> |
| 71 | + <MessageFeed> |
| 72 | + {testMessages.map(msg => ( |
| 73 | + <Message |
| 74 | + key={msg.id} |
| 75 | + messageBody={msg.messageBody} |
| 76 | + isSender={msg.isSender} |
| 77 | + /> |
| 78 | + ))} |
| 79 | + </MessageFeed> |
| 80 | + <InputBar onMessageSend={() => {}} /> |
| 81 | + </ChatWindow> |
| 82 | + </ChatMain> |
| 83 | + </ChatLayout> |
| 84 | + </LeafyGreenChatProvider> |
| 85 | +); |
17 | 86 |
|
18 | 87 | export const LiveExample: StoryObj<ChatLayoutProps> = { |
19 | 88 | render: Template, |
|
0 commit comments