Skip to content

Commit 2ce7130

Browse files
[RTE] Storybook update for rich text send box (#4442)
1 parent 77de15a commit 2ce7130

4 files changed

Lines changed: 61 additions & 5 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "none",
3+
"area": "improvement",
4+
"workstream": "RTE",
5+
"comment": "Storybook page update for rich text send box",
6+
"packageName": "@azure/communication-react",
7+
"email": "98852890+vhuseinova-msft@users.noreply.github.com",
8+
"dependentChangeType": "none"
9+
}

packages/storybook/stories/INTERNAL/RTE/RichTextSendBox.stories.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,43 @@
22
// Licensed under the MIT License.
33

44
import { RichTextSendBox as RichTextSendBoxComponent } from '@internal/react-components';
5-
import { Title, Description, Props, Heading, Canvas } from '@storybook/addon-docs';
5+
import { Title, Description, Props, Heading, Canvas, Source } from '@storybook/addon-docs';
66
import { Meta } from '@storybook/react/types-6-0';
77
import React from 'react';
88
import { DetailedBetaBanner } from '../../BetaBanners/DetailedBetaBanner';
99
import { COMPONENT_FOLDER_PREFIX } from '../../constants';
1010
import { hiddenControl } from '../../controlsUtils';
11+
import { RichTextSendBoxExample } from './snippets/RichTextSendBox.snippet';
1112
import { RichTextSendBoxAttachmentUploadsExample } from './snippets/RichTextSendBoxAttachmentUploads.snippet';
13+
import { RichTextSendBoxWithSystemMessageExample } from './snippets/RichTextSendBoxWithSystemMessage.snippet';
1214

15+
const RichTextSendBoxExampleText = require('!!raw-loader!./snippets/RichTextSendBox.snippet.tsx').default;
1316
const RichTextSendBoxAttachmentUploadsExampleText =
1417
require('!!raw-loader!./snippets/RichTextSendBoxAttachmentUploads.snippet.tsx').default;
18+
const RichTextSendBoxWithSystemMessageExampleText =
19+
require('!!raw-loader!./snippets/RichTextSendBoxWithSystemMessage.snippet.tsx').default;
20+
21+
const importStatement = `import { RichTextSendBox } from '@azure/communication-react';`;
1522

1623
const getDocs: () => JSX.Element = () => {
1724
return (
1825
<>
1926
<Title>RichTextSendBox</Title>
20-
<Description>
21-
Component for typing and sending messages. RichTextSendBox has a callback for sending typing notification when
22-
user starts entering text. It also supports an optional message below the text input field.
23-
</Description>
27+
<Description>Component for composing messages with rich text formatting.</Description>
28+
29+
<Heading>Importing</Heading>
30+
<Source code={importStatement} />
31+
32+
<Heading>Example</Heading>
33+
<Canvas mdxSource={RichTextSendBoxExampleText}>
34+
<RichTextSendBoxExample />
35+
</Canvas>
36+
37+
<Heading>Add a system message</Heading>
38+
<Description>To add a system message, use the systemMessage property like in the example below.</Description>
39+
<Canvas mdxSource={RichTextSendBoxWithSystemMessageExampleText}>
40+
<RichTextSendBoxWithSystemMessageExample />
41+
</Canvas>
2442

2543
<Heading>Display File Uploads</Heading>
2644
<DetailedBetaBanner />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { RichTextSendBox, FluentThemeProvider } from '@azure/communication-react';
2+
import React from 'react';
3+
4+
export const RichTextSendBoxExample: () => JSX.Element = () => (
5+
<FluentThemeProvider>
6+
<div style={{ width: '31.25rem' }}>
7+
<RichTextSendBox
8+
onSendMessage={async () => {
9+
return;
10+
}}
11+
/>
12+
</div>
13+
</FluentThemeProvider>
14+
);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { RichTextSendBox, FluentThemeProvider } from '@azure/communication-react';
2+
import React from 'react';
3+
4+
export const RichTextSendBoxWithSystemMessageExample: () => JSX.Element = () => (
5+
<FluentThemeProvider>
6+
<div style={{ width: '31.25rem' }}>
7+
<RichTextSendBox
8+
onSendMessage={async () => {
9+
return;
10+
}}
11+
systemMessage="Please wait 30 seconds to send new messages"
12+
/>
13+
</div>
14+
</FluentThemeProvider>
15+
);

0 commit comments

Comments
 (0)