From 52a3fe743e6122d157eaab3ad7bab0c70a96676b Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Oct 2020 17:42:29 -0400 Subject: [TMA-242] Twitter and Facebook Tagg View (#63) * modified the way we store social media data, initial skeleton * MVP? Twitter done? * cleaned up some things * forgot to lint and cleaned up some more code * minor change to text display * fixed some UI bug, linting, and minor adjustment to posts UI * fixed a couple of things * added DateLabel, Facebook taggs view, fixed minor stuff * Some small changes for the PR * removed unused Feed Co-authored-by: Ashm Walia --- src/components/taggs/TaggPost.tsx | 63 ++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 21 deletions(-) (limited to 'src/components/taggs/TaggPost.tsx') diff --git a/src/components/taggs/TaggPost.tsx b/src/components/taggs/TaggPost.tsx index 73f15268..0d3aee50 100644 --- a/src/components/taggs/TaggPost.tsx +++ b/src/components/taggs/TaggPost.tsx @@ -1,38 +1,59 @@ -import moment from 'moment'; import React from 'react'; -import {Image, StyleSheet, View} from 'react-native'; -import {PostType} from '../../types'; +import {Image, StyleSheet, Text, View} from 'react-native'; +import {SimplePostType} from '../../types'; import {SCREEN_WIDTH} from '../../utils'; +import {DateLabel} from '../common'; import TaggPostFooter from './TaggPostFooter'; interface TaggPostProps { - post: PostType; + post: SimplePostType; } -const TaggPost: React.FC = ({post: {socialHandle, data}}) => { - const parsedDate = moment(data?.timestamp || ''); - const date = parsedDate.isValid() ? parsedDate.format('MMM d') : ''; - - return ( - <> - - {data && } +const TaggPost: React.FC = ({post}) => { + if (post.media_type === 'photo') { + // Post with image and footer that shows caption + return ( + + + {post && ( + + )} + + + + ); + } else { + // Post with large text + return ( + + {post.caption} + - - - ); + ); + } }; const styles = StyleSheet.create({ + photoContainer: { + marginBottom: 50, + }, image: { width: SCREEN_WIDTH, height: SCREEN_WIDTH, backgroundColor: '#eee', + marginBottom: 30, + }, + textContianer: {marginBottom: 50, paddingHorizontal: 10}, + text: { + marginBottom: 30, + fontSize: 18, + color: 'white', + flexWrap: 'wrap', }, }); -- cgit v1.2.3-70-g09d2