Rename media gallery items
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
|
||||
import { DocumentListEntry } from './DocumentListEntry';
|
||||
import { ImageThumbnail } from './ImageThumbnail';
|
||||
import { DocumentListItem } from './DocumentListItem';
|
||||
import { MediaGridItem } from './MediaGridItem';
|
||||
import { Message } from './propTypes/Message';
|
||||
import { missingCaseError } from '../../../util/missingCaseError';
|
||||
|
||||
@@ -33,7 +33,7 @@ interface Props {
|
||||
messages: Array<Message>;
|
||||
}
|
||||
|
||||
export class AttachmentListSection extends React.Component<Props, {}> {
|
||||
export class AttachmentSection extends React.Component<Props, {}> {
|
||||
public renderItems() {
|
||||
const { i18n, messages, type } = this.props;
|
||||
|
||||
@@ -43,15 +43,10 @@ export class AttachmentListSection extends React.Component<Props, {}> {
|
||||
|
||||
switch (type) {
|
||||
case 'media':
|
||||
return (
|
||||
<ImageThumbnail
|
||||
key={message.received_at}
|
||||
message={message}
|
||||
/>
|
||||
);
|
||||
return <MediaGridItem key={message.received_at} message={message} />;
|
||||
case 'documents':
|
||||
return (
|
||||
<DocumentListEntry
|
||||
<DocumentListItem
|
||||
key={message.received_at}
|
||||
i18n={i18n}
|
||||
fileSize={firstAttachment.size}
|
@@ -1,17 +1,17 @@
|
||||
DocumentListEntry example:
|
||||
DocumentListItem example:
|
||||
|
||||
```js
|
||||
<DocumentListEntry
|
||||
<DocumentListItem
|
||||
fileName="meow.jpg"
|
||||
fileSize={1024 * 1000 * 2}
|
||||
timestamp={Date.now()}
|
||||
/>
|
||||
<DocumentListEntry
|
||||
<DocumentListItem
|
||||
fileName="rickroll.wmv"
|
||||
fileSize={1024 * 1000 * 8}
|
||||
timestamp={Date.now() - 24 * 60 * 1000}
|
||||
/>
|
||||
<DocumentListEntry
|
||||
<DocumentListItem
|
||||
fileName="kitten.gif"
|
||||
fileSize={1024 * 1000 * 1.2}
|
||||
timestamp={Date.now() - 14 * 24 * 60 * 1000}
|
@@ -52,7 +52,7 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
export class DocumentListEntry extends React.Component<Props, {}> {
|
||||
export class DocumentListItem extends React.Component<Props, {}> {
|
||||
public renderContent() {
|
||||
const { fileName, fileSize, timestamp } = this.props;
|
||||
|
@@ -5,7 +5,7 @@ import React from 'react';
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
import { AttachmentListSection } from './AttachmentListSection';
|
||||
import { AttachmentSection } from './AttachmentSection';
|
||||
import { groupMessagesByDate } from './groupMessagesByDate';
|
||||
import { Message } from './propTypes/Message';
|
||||
|
||||
@@ -131,7 +131,7 @@ export class MediaGallery extends React.Component<Props, State> {
|
||||
? date.format(MONTH_FORMAT)
|
||||
: i18n(section.type);
|
||||
return (
|
||||
<AttachmentListSection
|
||||
<AttachmentSection
|
||||
key={header}
|
||||
header={header}
|
||||
i18n={i18n}
|
||||
|
@@ -6,7 +6,6 @@ import React from 'react';
|
||||
import { LoadingIndicator } from './LoadingIndicator';
|
||||
import { Message } from './propTypes/Message';
|
||||
|
||||
|
||||
interface Props {
|
||||
message: Message;
|
||||
}
|
||||
@@ -28,7 +27,7 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
export class ImageThumbnail extends React.Component<Props, {}> {
|
||||
export class MediaGridItem extends React.Component<Props, {}> {
|
||||
public renderContent() {
|
||||
const { message } = this.props;
|
||||
|
@@ -9,9 +9,9 @@
|
||||
// const type: AttachmentType = selectedTab;
|
||||
// switch (type) {
|
||||
// case 'media':
|
||||
// return <ImageThumbnail/>;
|
||||
// return <MediaGridItem/>;
|
||||
// case 'documents':
|
||||
// return <DocumentListEntry/>;
|
||||
// return <DocumentListItem/>;
|
||||
// default:
|
||||
// return missingCaseError(type);
|
||||
// }
|
||||
|
Reference in New Issue
Block a user