@@ -21,7 +21,7 @@ import {
21
21
IDropdownOption
22
22
} from '@fluentui/react' ;
23
23
import { Divider } from '@fluentui/react-components' ;
24
- import { Canvas , Description , Heading , Props , Source , Title } from '@storybook/addon-docs' ;
24
+ import { Canvas , Description , Heading , Props , Source , Subtitle , Title } from '@storybook/addon-docs' ;
25
25
import { Meta } from '@storybook/react/types-6-0' ;
26
26
import React , { useEffect , useRef , useState } from 'react' ;
27
27
import { DetailedBetaBanner } from '../BetaBanners/DetailedBetaBanner' ;
@@ -54,6 +54,7 @@ import { MessageThreadWithCustomTimestampExample } from './snippets/CustomTimest
54
54
import { DefaultMessageThreadExample } from './snippets/Default.snippet' ;
55
55
import { MessageThreadWithMessageStatusIndicatorExample } from './snippets/MessageStatusIndicator.snippet' ;
56
56
import { MessageWithAttachment } from './snippets/MessageWithAttachment.snippet' ;
57
+ import { MessageWithAttachmentFromTeams } from './snippets/MessageWithAttachmentFromTeams.snippet' ;
57
58
import { MessageWithCustomAttachment } from './snippets/MessageWithCustomAttachment.snippet' ;
58
59
import { MessageWithCustomMentionRenderer } from './snippets/MessageWithCustomMentionRenderer.snippet' ;
59
60
import { MessageThreadWithSystemMessagesExample } from './snippets/SystemMessages.snippet' ;
@@ -80,6 +81,8 @@ const DefaultMessageThreadExampleText = require('!!raw-loader!./snippets/Default
80
81
const MessageThreadWithMessageStatusIndicatorExampleText =
81
82
require ( '!!raw-loader!./snippets/MessageStatusIndicator.snippet.tsx' ) . default ;
82
83
const MessageWithAttachmentText = require ( '!!raw-loader!./snippets/MessageWithAttachment.snippet.tsx' ) . default ;
84
+ const MessageWithAttachmentFromTeamsText =
85
+ require ( '!!raw-loader!./snippets/MessageWithAttachmentFromTeams.snippet.tsx' ) . default ;
83
86
const MessageWithCustomAttachmentText =
84
87
require ( '!!raw-loader!./snippets/MessageWithCustomAttachment.snippet.tsx' ) . default ;
85
88
const MessageWithCustomMentionRendererText =
@@ -346,19 +349,37 @@ const Docs: () => JSX.Element = () => {
346
349
347
350
< div ref = { refDisplayAttachments } >
348
351
< Heading > Display Messages with Attachments</ Heading >
352
+ < Subtitle > Basic Usage: Default Attachment Rendering</ Subtitle >
349
353
< DetailedBetaBanner />
350
354
< Description >
351
- The MessageThread component supports rendering of message attachments, including multiple ways to customize
352
- it. Developers can opt to use the default attachment rendering by not providing `attachmentOptions`. In the
353
- following example, the default attachment rendering is shown with an attachment on the first chat message. By
354
- default, the browser `window.open` method will be called with the target URL.
355
+ The MessageThread component renders message attachments without any additional configuration. Simply provide a
356
+ list of `ChatMessages` with attachments of type `AttachmentMetadata` and the component will render the message
357
+ content along with associated attachments.
358
+ </ Description >
359
+ < Description >
360
+ By default, the button associated with the attachment card will open the attachment in a new tab.
361
+ Specifically, `window.open` method will be called for target `URL` defined in `AttachmentMetadata`.
355
362
</ Description >
356
363
< Canvas mdxSource = { MessageWithAttachmentText } >
357
364
< MessageWithAttachment />
358
365
</ Canvas >
359
366
< Description >
360
- The `attachmentOptions` allows the attachmentCard to be customized in multiple ways. For example, developers
361
- can have a custom icon, label for the button and custom `onClick` callback.
367
+ If the identity of message sender is a Microsoft Teams user, the attachment will be rendered with an `open`
368
+ icon shown below.
369
+ </ Description >
370
+ < Canvas mdxSource = { MessageWithAttachmentFromTeamsText } >
371
+ < MessageWithAttachmentFromTeams />
372
+ </ Canvas >
373
+ < Subtitle > Advanced Usage: Customizing Attachment Rendering</ Subtitle >
374
+ < DetailedBetaBanner />
375
+ < Description >
376
+ The MessageThread component also supports multiple ways to customize the rendering. You can leverage the
377
+ `attachmentOptions.downloadOptions` props to provide a dynamic list of menu action buttons that will be based
378
+ on properties of the attachment or the chat message associated with it. Moreover, you can also opt to provide
379
+ a static list for all secanrios.
380
+ </ Description >
381
+ < Description >
382
+ For example, the following code snippet demonstrates how to customize the download options for attachments.
362
383
</ Description >
363
384
< Canvas mdxSource = { MessageWithCustomAttachmentText } >
364
385
< MessageWithCustomAttachment />
@@ -657,7 +678,11 @@ export default {
657
678
onRenderMessage : hiddenControl ,
658
679
onUpdateMessage : hiddenControl ,
659
680
onDeleteMessage : hiddenControl ,
660
- disableEditing : hiddenControl
681
+ disableEditing : hiddenControl ,
682
+ // hide unnecessary props since we "send message with attachments" option
683
+ onRenderAttachmentDownloads : hiddenControl ,
684
+ attachmentOptions : hiddenControl ,
685
+ onSendMessage : hiddenControl
661
686
} ,
662
687
parameters : {
663
688
docs : {
0 commit comments