import React from 'react'; import classNames from 'classnames'; import moment from 'moment'; // tslint:disable-next-line:match-default-export-name import formatFileSize from 'filesize'; interface Props { // Required timestamp: number; // Optional fileName?: string; fileSize?: number; onClick?: () => void; shouldShowSeparator?: boolean; } export class DocumentListItem extends React.Component { public static defaultProps: Partial = { shouldShowSeparator: true, }; public render() { const { shouldShowSeparator } = this.props; return (
{this.renderContent()}
); } private renderContent() { const { fileName, fileSize, timestamp } = this.props; return (
{fileName} {typeof fileSize === 'number' ? formatFileSize(fileSize) : ''}
{moment(timestamp).format('ddd, MMM D, Y')}
); } }