change profile tab to be stack nav like posts as well as changing created to open in postmodel
This commit is contained in:
@@ -5,22 +5,23 @@ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
||||
import { Post, StatusEnum } from '../models/postModel'
|
||||
|
||||
export const CompactPostComponent: React.FC<Post> = (post) => {
|
||||
|
||||
return (
|
||||
<TouchableOpacity key={post._id} style={styles.posts} onPress={()=>{
|
||||
router.push({
|
||||
pathname: '/posts/details',
|
||||
params: {
|
||||
id: post._id,
|
||||
}
|
||||
})
|
||||
}}>
|
||||
<TouchableOpacity
|
||||
key={post._id}
|
||||
style={styles.posts}
|
||||
onPress={() => {
|
||||
router.push({
|
||||
pathname: '/posts/details',
|
||||
params: {
|
||||
id: post._id
|
||||
}
|
||||
})
|
||||
}}
|
||||
>
|
||||
<View style={styles.header}>
|
||||
<Text style={[styles.text, styles.date]}>{post.notes}</Text>
|
||||
<Text style={[styles.text, styles.title]}>{post.notes}</Text>
|
||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
||||
{post.status === StatusEnum.Created && (
|
||||
<Text style={[styles.created, styles.statusTag]}>Created</Text>
|
||||
)}
|
||||
{post.status === StatusEnum.Created && <Text style={[styles.open, styles.statusTag]}>Open</Text>}
|
||||
{post.status === StatusEnum.Pending && (
|
||||
<Text style={[styles.pending, styles.statusTag]}>Pending</Text>
|
||||
)}
|
||||
@@ -31,7 +32,7 @@ export const CompactPostComponent: React.FC<Post> = (post) => {
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.footer}>
|
||||
<Text style={styles.subtext}>{post.address}</Text>
|
||||
<Text style={[styles.subtext, styles.address]}>{post.address}</Text>
|
||||
<Text style={[styles.subtext]}>{new Date(post.date).toLocaleDateString()}</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
@@ -64,14 +65,18 @@ const styles = StyleSheet.create({
|
||||
marginBottom: 16
|
||||
},
|
||||
footer: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
|
||||
date: {
|
||||
title: {
|
||||
paddingVertical: 3,
|
||||
borderRadius: 6,
|
||||
color: '#ffffff',
|
||||
fontSize: 16
|
||||
fontSize: 16,
|
||||
paddingRight: 10
|
||||
},
|
||||
address: {
|
||||
paddingRight: 15
|
||||
},
|
||||
statusTag: { paddingVertical: 3, paddingHorizontal: 10, borderRadius: 6, fontSize: 16 },
|
||||
created: { backgroundColor: '#0d6efd', color: '#ffffff' },
|
||||
open: { backgroundColor: '#0d6efd', color: '#ffffff' },
|
||||
pending: { backgroundColor: '#ffc107', color: '#000000' },
|
||||
denied: { backgroundColor: '#dc3545', color: '#ffffff' },
|
||||
approved: { backgroundColor: '#198754', color: '#ffffff' }
|
||||
|
||||
Reference in New Issue
Block a user