aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/TaggAvatar.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-05-07 16:01:47 -0400
committerIvan Chen <ivan@tagg.id>2021-05-07 16:01:47 -0400
commit76bc8c5825f39257be6e7648d12b858f1e805569 (patch)
treeb94d9570439ebfa42e6664144f124abe5d4113e3 /src/components/profile/TaggAvatar.tsx
parent65c7411f4609edac3d4d5f23fc031ed274fc5872 (diff)
parentc9d32e68fbb9d1bc175722bfda49454a6f627eae (diff)
Merge branch 'master' into tma821-load-badges-faster-ft
# Conflicts: # src/utils/users.ts
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;