aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/TaggAvatar.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-04-27 10:46:17 -0400
committerIvan Chen <ivan@tagg.id>2021-04-27 10:46:17 -0400
commita13dcb5110245bb554d79e779c4942e6f5aaf18a (patch)
treebb8e5bebe2cf5677d0ffc9b72819a56c9d309cbf /src/components/profile/TaggAvatar.tsx
parentcaac607ed90c35ad8d4b2787b170e1fd1f165333 (diff)
refactored avatar
Diffstat (limited to 'src/components/profile/TaggAvatar.tsx')
-rw-r--r--src/components/profile/TaggAvatar.tsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/components/profile/TaggAvatar.tsx b/src/components/profile/TaggAvatar.tsx
new file mode 100644
index 00000000..ea0bdb65
--- /dev/null
+++ b/src/components/profile/TaggAvatar.tsx
@@ -0,0 +1,35 @@
+import React from 'react';
+import {StyleSheet} from 'react-native';
+import {useSelector} from 'react-redux';
+import {RootState} from '../../store/rootreducer';
+import {ScreenType} from '../../types';
+import {Avatar} from '../common';
+
+const PROFILE_DIM = 100;
+
+interface TaggAvatarProps {
+ style?: object;
+ userXId: string | undefined;
+ screenType: ScreenType;
+}
+const TaggAvatar: React.FC<TaggAvatarProps> = ({
+ style,
+ screenType,
+ userXId,
+}) => {
+ const {avatar} = useSelector((state: RootState) =>
+ userXId ? state.userX[screenType][userXId] : state.user,
+ );
+
+ return <Avatar style={[styles.image, style]} uri={avatar} />;
+};
+
+const styles = StyleSheet.create({
+ image: {
+ height: PROFILE_DIM,
+ width: PROFILE_DIM,
+ borderRadius: PROFILE_DIM / 2,
+ },
+});
+
+export default TaggAvatar;