Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[home] Update content card #63

Merged
merged 22 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@mui/material": "^5.14.13",
"@mui/styled-engine-sc": "^6.0.0-alpha.1",
"@mui/system": "^5.14.13",
"@react-native-async-storage/async-storage": "1.18.2",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-native-community/datetimepicker": "7.2.0",
"@react-navigation/bottom-tabs": "^6.5.9",
"@react-navigation/material-bottom-tabs": "^6.2.17",
Expand Down
1 change: 0 additions & 1 deletion src/app/(tabs)/author/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { SafeAreaView } from 'react-native-safe-area-context';

import styles from './styles';
import BackButton from '../../../components/BackButton/BackButton';
import ContentCard from '../../../components/ContentCard/ContentCard';
import HorizontalLine from '../../../components/HorizontalLine/HorizontalLine';
import PreviewCard from '../../../components/PreviewCard/PreviewCard';
import {
Expand Down
2 changes: 2 additions & 0 deletions src/app/(tabs)/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function HomeScreen() {
key={story.title}
title={story.title}
author={story.author_name}
authorImage={story.author_image}
pressFunction={() =>
router.push({
pathname: '/story',
Expand Down Expand Up @@ -151,6 +152,7 @@ function HomeScreen() {
key={story.title}
title={story.title}
author={story.author_name}
authorImage={story.author_image}
pressFunction={() =>
router.push({
pathname: '/story',
Expand Down
1 change: 1 addition & 0 deletions src/app/(tabs)/home/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const styles = StyleSheet.create({
scrollView: {
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
marginBottom: 20,
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
flexGrow: 0,
padding: 8,
},
headerContainer: {
flexDirection: 'row',
Expand Down
2 changes: 0 additions & 2 deletions src/app/(tabs)/story/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ function StoryScreen() {
ref={scrollRef}
showsVerticalScrollIndicator={false}
>
{/* <Image style={styles.image} source={{ uri: story.featured_media }} /> */}

<Text style={styles.title}>{story?.title}</Text>
<TouchableOpacity
onPress={() => {
Expand Down
5 changes: 0 additions & 5 deletions src/app/(tabs)/story/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ const styles = StyleSheet.create({
paddingRight: 24,
paddingTop: 48,
},
image: {
width: '100%',
height: 153,
marginBottom: 16,
},
authorImage: {
backgroundColor: '#D9D9D9',
width: 21,
Expand Down
61 changes: 57 additions & 4 deletions src/components/ContentCard/ContentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Pressable,
Text,
View,
TouchableOpacity,
} from 'react-native';

import styles from './styles';
Expand All @@ -13,26 +14,78 @@ type ContentCardProps = {
title: string;
author: string;
image: string;
authorImage: string;
pressFunction: (event: GestureResponderEvent) => void;
};

function ContentCard({
title,
author,
image,
authorImage,
pressFunction,
}: ContentCardProps) {
const saveStory = () => {
console.log("testing '+' icon does something for story " + title);
};

return (
<Pressable onPress={pressFunction}>
<View style={styles.contentCard}>
<Image style={styles.image} source={{ uri: image }} />
<View style={{ flexDirection: 'row' }}>
<Image style={styles.image} source={{ uri: image }} />
<Image
style={styles.authors}
source={{
uri: 'https://gwn-uploads.s3.amazonaws.com/wp-content/uploads/2023/12/10090438/Angela-Trakoshis-100x100.jpg' /* change image for proper author when we can pull author images properly */,
}}
/>
</View>

<View style={styles.textContainer}>
<Text style={[globalStyles.h3, styles.title]} numberOfLines={1}>
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
{title}
</Text>
<Text style={globalStyles.body1} numberOfLines={1}>
{author}
</Text>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Text style={globalStyles.subtext} numberOfLines={1}>
By{' '}
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
</Text>
<Text style={globalStyles.subHeading1} numberOfLines={1}>
Marcoss28 marked this conversation as resolved.
Show resolved Hide resolved
{author}
</Text>
</View>
<View style={styles.buttons}>
<View>
<TouchableOpacity
onPress={() => null}
style={{ flexDirection: 'row' }}
>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<Image
style={styles.reactions}
source={require('./savedStoriesIcon.png')}
/>
<View style={styles.reactionNumber}>
<Text style={globalStyles.subtext}>
14{/*change number to work*/}
</Text>
</View>
</TouchableOpacity>
</View>
<TouchableOpacity onPress={() => saveStory()}>
<Image
style={{ width: 40, height: 40 }}
source={require('./savedStoriesIcon.png')}
/>
</TouchableOpacity>
</View>
</View>
</View>
</Pressable>
Expand Down
Binary file added src/components/ContentCard/savedStoriesIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 45 additions & 1 deletion src/components/ContentCard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,63 @@ const styles = StyleSheet.create({
marginRight: 20,
flexDirection: 'column',
justifyContent: 'space-between',
backgroundColor: '#FFF',
borderRadius: 6,
shadowColor: colors.black,
shadowOpacity: 0.5,
shadowOffset: { width: 0, height: 4 },
shadowRadius: 5,
elevation: 4,
},
image: {
margin: 10,
justifyContent: 'center',
alignItems: 'center',
height: 140,
width: 148,
backgroundColor: colors.lime,
borderRadius: 4,
marginBottom: 8,
},
authors: {
width: 30,
height: 30,
borderRadius: 30 / 2,
borderWidth: 1,
backgroundColor: '#89CFF0',
borderColor: 'white',
marginTop: 15,
marginLeft: -45,
flexDirection: 'row',
},
textContainer: {
width: 148,
width: 166,
paddingLeft: 10,
paddingRight: 10,
paddingBottom: 10,
},
title: {
marginBottom: 4,
padding: 0,
},
reactionNumber: {
marginLeft: 15,
marginTop: 10,
},
reactions: {
width: 20,
height: 20,
borderRadius: 20 / 2,
borderWidth: 1,
backgroundColor: '#89CFF0', //different per emoji reaction
borderColor: 'white',
marginTop: 10,
marginRight: -10,
},
buttons: {
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 5,
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/PreviewCard/PreviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as cheerio from 'cheerio';
import {
GestureResponderEvent,
Image,
Pressable,
Text,
View,
} from 'react-native';
import * as cheerio from 'cheerio';

import styles from './styles';
import globalStyles from '../../styles/globalStyles';
Expand Down
1 change: 1 addition & 0 deletions src/queries/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface StoryCard {
title: string;
author_name: string;
featured_media: string;
author_image: string;
}

export interface Subgenre {
Expand Down
Loading