1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import isImage from 'is-image';
7 import { withStyles, WithStyles } from '@material-ui/core';
8 import { FileTreeData } from '~/components/file-tree/file-tree-data';
9 import { CollectionFileType } from '~/models/collection-file';
11 export interface FileThumbnailProps {
15 export const FileThumbnail =
16 ({ file }: FileThumbnailProps) =>
17 file.type === CollectionFileType.FILE && isImage(file.name)
18 ? <ImageFileThumbnail file={file} />
21 type ImageFileThumbnailCssRules = 'thumbnail';
23 const imageFileThumbnailStyle = withStyles<ImageFileThumbnailCssRules>(theme => ({
26 margin: `${theme.spacing.unit}px 0`,
30 const ImageFileThumbnail = imageFileThumbnailStyle(
31 ({ classes, file }: WithStyles<ImageFileThumbnailCssRules> & FileThumbnailProps) =>
33 className={classes.thumbnail}