2018-12-02 01:48:53 +00:00
|
|
|
### One image
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const attachments = [
|
|
|
|
{
|
|
|
|
url: util.gifObjectUrl,
|
|
|
|
contentType: 'image/gif',
|
|
|
|
width: 320,
|
|
|
|
height: 240,
|
|
|
|
},
|
|
|
|
];
|
2019-01-10 20:26:28 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<AttachmentList
|
|
|
|
attachments={attachments}
|
|
|
|
onClose={() => console.log('onClose')}
|
|
|
|
onClickAttachment={attachment => {
|
|
|
|
console.log('onClickAttachment', attachment);
|
|
|
|
}}
|
|
|
|
onCloseAttachment={attachment => {
|
|
|
|
console.log('onCloseAttachment', attachment);
|
|
|
|
}}
|
2019-01-15 17:33:23 +00:00
|
|
|
onAddAttachment={() => console.log('onAddAttachment')}
|
2019-01-10 20:26:28 +00:00
|
|
|
i18n={util.i18n}
|
2019-01-15 17:33:23 +00:00
|
|
|
/>
|
2019-01-10 20:26:28 +00:00
|
|
|
</util.ConversationContext>;
|
2018-12-02 01:48:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Four images
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const attachments = [
|
|
|
|
{
|
|
|
|
url: util.gifObjectUrl,
|
|
|
|
contentType: 'image/png',
|
|
|
|
width: 320,
|
|
|
|
height: 240,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: util.pngObjectUrl,
|
|
|
|
contentType: 'image/png',
|
|
|
|
width: 800,
|
|
|
|
height: 1200,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: util.landscapeObjectUrl,
|
|
|
|
contentType: 'image/png',
|
|
|
|
width: 4496,
|
|
|
|
height: 3000,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: util.landscapeGreenObjectUrl,
|
|
|
|
contentType: 'image/png',
|
|
|
|
width: 1000,
|
|
|
|
height: 50,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-01-10 20:26:28 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-12-02 01:48:53 +00:00
|
|
|
<AttachmentList
|
|
|
|
attachments={attachments}
|
|
|
|
onClose={() => console.log('onClose')}
|
|
|
|
onClickAttachment={attachment => {
|
|
|
|
console.log('onClickAttachment', attachment);
|
|
|
|
}}
|
|
|
|
onCloseAttachment={attachment => {
|
|
|
|
console.log('onCloseAttachment', attachment);
|
|
|
|
}}
|
2019-01-15 17:33:23 +00:00
|
|
|
onAddAttachment={() => console.log('onAddAttachment')}
|
2018-12-02 01:48:53 +00:00
|
|
|
i18n={util.i18n}
|
|
|
|
/>
|
2019-01-10 20:26:28 +00:00
|
|
|
</util.ConversationContext>;
|
2018-12-02 01:48:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### A mix of attachment types
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const attachments = [
|
|
|
|
{
|
|
|
|
url: util.gifObjectUrl,
|
|
|
|
contentType: 'image/gif',
|
|
|
|
width: 320,
|
|
|
|
height: 240,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
contentType: 'text/plain',
|
|
|
|
fileName: 'manifesto.txt',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
url: util.pngObjectUrl,
|
|
|
|
contentType: 'image/png',
|
|
|
|
width: 800,
|
|
|
|
height: 1200,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-01-10 20:26:28 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-12-02 01:48:53 +00:00
|
|
|
<AttachmentList
|
|
|
|
attachments={attachments}
|
|
|
|
onClose={() => console.log('onClose')}
|
|
|
|
onClickAttachment={attachment => {
|
|
|
|
console.log('onClickAttachment', attachment);
|
|
|
|
}}
|
|
|
|
onCloseAttachment={attachment => {
|
|
|
|
console.log('onCloseAttachment', attachment);
|
|
|
|
}}
|
2019-01-15 17:33:23 +00:00
|
|
|
onAddAttachment={() => console.log('onAddAttachment')}
|
2018-12-02 01:48:53 +00:00
|
|
|
i18n={util.i18n}
|
|
|
|
/>
|
2019-01-10 20:26:28 +00:00
|
|
|
</util.ConversationContext>;
|
2018-12-02 01:48:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### No attachments provided
|
|
|
|
|
|
|
|
Nothing is shown if attachment list is empty.
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
<AttachmentList attachments={[]} i18n={util.i18n} />
|
|
|
|
```
|