* add channel files screen * fix filtering * refactor code and fix style * add search and some refactoring * fix lint * refactoring * move file filters to files directory * fix dependecy * UX fixes and minor memo dependency changes * fix empty state on Ipad * fix search issues * fix lint error * fix search issue * fix loading on filter changes * show different text if no files found when filter is applied * feedback review --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import React from 'react';
|
|
import {View, StyleSheet} from 'react-native';
|
|
|
|
import FileIcon from '@components/files/file_icon';
|
|
import ImageFile from '@components/files/image_file';
|
|
import VideoFile from '@components/files/video_file';
|
|
import {isImage, isVideo} from '@utils/file';
|
|
|
|
export const ICON_SIZE = 72;
|
|
|
|
const styles = StyleSheet.create({
|
|
imageVideo: {
|
|
height: ICON_SIZE,
|
|
width: ICON_SIZE,
|
|
},
|
|
});
|
|
|
|
type Props = {
|
|
fileInfo: FileInfo;
|
|
}
|
|
const Icon = ({fileInfo}: Props) => {
|
|
switch (true) {
|
|
case isImage(fileInfo):
|
|
return (
|
|
<View style={styles.imageVideo}>
|
|
<ImageFile
|
|
file={fileInfo}
|
|
inViewPort={true}
|
|
resizeMode={'cover'}
|
|
/>
|
|
</View>
|
|
);
|
|
case isVideo(fileInfo):
|
|
return (
|
|
<View style={styles.imageVideo}>
|
|
<VideoFile
|
|
file={fileInfo}
|
|
resizeMode={'cover'}
|
|
inViewPort={true}
|
|
index={0}
|
|
wrapperWidth={78}
|
|
/>
|
|
</View>
|
|
);
|
|
default:
|
|
return (
|
|
<FileIcon
|
|
file={fileInfo}
|
|
iconSize={72}
|
|
/>
|
|
);
|
|
}
|
|
};
|
|
|
|
export default Icon;
|