2018-07-20 23:37:57 +00:00
|
|
|
#### With image
|
2018-07-09 21:29:13 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
2018-07-18 23:00:51 +00:00
|
|
|
thumbnailObjectUrl: 'https://placekitten.com/76/67',
|
2018-07-09 21:29:13 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
2018-07-18 23:00:51 +00:00
|
|
|
contentType: 'image/jpeg',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
2018-07-20 23:37:57 +00:00
|
|
|
#### With video
|
2018-07-18 23:00:51 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
thumbnailObjectUrl: 'https://placekitten.com/76/67',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'video/mp4',
|
2018-07-09 21:29:13 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
2018-07-20 23:37:57 +00:00
|
|
|
#### Missing image
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'image/jpeg',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Missing video
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Image thumbnail failed to load
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
thumbnailObjectUrl: 'nonexistent',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'image/jpeg',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Video thumbnail failed to load
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
thumbnailObjectUrl: 'nonexistent',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Other contentType
|
2018-07-09 21:29:13 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const message = {
|
|
|
|
id: '1',
|
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
fileName: 'foo.jpg',
|
|
|
|
contentType: 'application/json',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
<MediaGridItem i18n={util.i18n} message={message} />;
|
|
|
|
```
|