0e7f7e1dfd
Generated by create-expo-app 3.2.0.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { COLORS } from "@/constants/colors";
|
|
import { Person } from "@/types/person";
|
|
import { Link } from "expo-router";
|
|
import React from "react";
|
|
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
|
|
const PersonItem: React.FC<{ item: Person }> = ({ item }) => {
|
|
const id = item.url.split("/").filter(Boolean).pop();
|
|
return (
|
|
<Link href={`/people/${id}`} asChild>
|
|
<TouchableOpacity>
|
|
<View style={styles.peopleItem}>
|
|
<Text style={styles.title}>{item.name}</Text>
|
|
<Text style={styles.details}>Birth year: {item.birth_year}</Text>
|
|
<Text style={styles.details}>Gender: {item.gender}</Text>
|
|
</View>
|
|
</TouchableOpacity>
|
|
</Link>
|
|
);
|
|
};
|
|
|
|
export default PersonItem;
|
|
|
|
const styles = StyleSheet.create({
|
|
peopleItem: {
|
|
backgroundColor: COLORS.background,
|
|
padding: 16,
|
|
marginVertical: 8,
|
|
marginHorizontal: 16,
|
|
borderRadius: 8,
|
|
},
|
|
title: {
|
|
fontSize: 18,
|
|
fontWeight: "bold",
|
|
color: COLORS.text,
|
|
marginBottom: 8,
|
|
},
|
|
details: {
|
|
fontSize: 14,
|
|
color: "#fff",
|
|
},
|
|
});
|