Rocket.Chat.ReactNative/app/views/WorkspaceView/ServerAvatar.tsx

44 lines
956 B
TypeScript
Raw Normal View History

import React from 'react';
2023-03-07 12:28:51 +00:00
import { StyleSheet, View } from 'react-native';
import FastImage from 'react-native-fast-image';
import { isTablet } from '../../lib/methods/helpers';
import { useTheme } from '../../theme';
const SIZE = 96;
const MARGIN_TOP = isTablet ? 0 : 64;
const BORDER_RADIUS = 8;
const styles = StyleSheet.create({
container: {
marginBottom: 16,
width: '100%',
height: SIZE + MARGIN_TOP,
justifyContent: 'flex-end',
alignItems: 'center'
},
image: {
width: SIZE,
height: SIZE,
borderRadius: BORDER_RADIUS
}
});
interface IServerAvatar {
url: string;
image: string;
}
2023-03-07 12:28:51 +00:00
// TODO: missing skeleton
const ServerAvatar = React.memo(({ url, image }: IServerAvatar) => {
const { colors } = useTheme();
return (
<View style={styles.container}>
{image && <FastImage style={[styles.image, { borderColor: colors.borderColor }]} source={{ uri: `${url}/${image}` }} />}
</View>
);
});
export default ServerAvatar;