From d0237cbb61e5c4d77c7b0cefc50891639646ee91 Mon Sep 17 00:00:00 2001 From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com> Date: Thu, 22 Oct 2020 15:34:21 -0700 Subject: [TMA 236] Comments PR (#64) * Added comments count and retrieve comments * Working draft * The one before cleanup * Finally * Added time icon and major refactoring * Small fix for social media taggs * Addressed review comments --- src/components/comments/CommentTile.tsx | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/components/comments/CommentTile.tsx (limited to 'src/components/comments/CommentTile.tsx') diff --git a/src/components/comments/CommentTile.tsx b/src/components/comments/CommentTile.tsx new file mode 100644 index 00000000..02840d47 --- /dev/null +++ b/src/components/comments/CommentTile.tsx @@ -0,0 +1,71 @@ +import React from 'react'; +import {Text, View} from 'react-native-animatable'; +import {ProfilePreview} from '../profile'; +import {CommentType} from '../../types'; +import {StyleSheet} from 'react-native'; +import {getTimePosted} from '../../utils'; +import ClockIcon from '../../assets/icons/clock-icon-01.svg'; + +/** + * Displays users's profile picture, comment posted by them and the time difference between now and when a comment was posted. + */ + +interface CommentTileProps { + comment_object: CommentType; +} + +const CommentTile: React.FC = ({comment_object}) => { + const timePosted = getTimePosted(comment_object.date_time); + return ( + + + + {comment_object.comment} + + + {' ' + timePosted} + + + + ); +}; + +const styles = StyleSheet.create({ + container: { + marginLeft: '3%', + marginRight: '3%', + borderBottomWidth: 1, + borderColor: 'lightgray', + marginBottom: '3%', + }, + body: { + marginLeft: 56, + }, + comment: { + position: 'relative', + top: -5, + marginBottom: '2%', + }, + date_time: { + color: 'gray', + }, + clockIcon: { + width: 12, + height: 12, + alignSelf: 'center', + }, + clockIconAndTime: { + flexDirection: 'row', + marginBottom: '3%', + }, +}); + +export default CommentTile; -- cgit v1.2.3-70-g09d2