aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments/MomentCommentPreview.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-08 17:43:04 -0400
committerIvan Chen <ivan@tagg.id>2021-06-08 17:43:04 -0400
commit18770a692d03fb68267b51ef05cd4b58917b0e62 (patch)
tree019e242ea8f4c85acb56ea82903883bbb2f971d6 /src/components/moments/MomentCommentPreview.tsx
parentc6832a84caf1f23c2115a3b8061e120f9fab623d (diff)
Create MomentCommentPrevew component
Diffstat (limited to 'src/components/moments/MomentCommentPreview.tsx')
-rw-r--r--src/components/moments/MomentCommentPreview.tsx52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/components/moments/MomentCommentPreview.tsx b/src/components/moments/MomentCommentPreview.tsx
new file mode 100644
index 00000000..45bbbfad
--- /dev/null
+++ b/src/components/moments/MomentCommentPreview.tsx
@@ -0,0 +1,52 @@
+import {useNavigation} from '@react-navigation/native';
+import React from 'react';
+import {StyleSheet, Text} from 'react-native';
+import {TouchableOpacity} from 'react-native-gesture-handler';
+import {MomentPostType, ScreenType} from '../../types';
+import {normalize} from '../../utils';
+
+interface MomentCommentPreviewProps {
+ moment: MomentPostType;
+ screenType: ScreenType;
+}
+
+const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({
+ moment,
+ screenType,
+}) => {
+ const navigation = useNavigation();
+ const commentCountText =
+ moment.comments_count === 0
+ ? 'No Comments'
+ : moment.comments_count + ' comments';
+
+ return (
+ <TouchableOpacity
+ style={styles.commentsPreviewContainer}
+ onPress={() =>
+ navigation.push('MomentCommentsScreen', {
+ moment_id: moment.moment_id,
+ screenType,
+ })
+ }>
+ <Text style={styles.commentCount}>{commentCountText}</Text>
+ <Text>TODO: Add comment preview here</Text>
+ </TouchableOpacity>
+ );
+};
+
+const styles = StyleSheet.create({
+ commentsPreviewContainer: {
+ flexDirection: 'column',
+ marginHorizontal: '5%',
+ marginBottom: '2%',
+ borderWidth: 1,
+ },
+ commentCount: {
+ fontWeight: '700',
+ color: 'white',
+ fontSize: normalize(12),
+ },
+});
+
+export default MomentCommentPreview;