Initial commit
Generated by create-expo-app 3.2.0.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { COLORS } from "@/constants/colors";
|
||||
import { Film } from "@/types/film";
|
||||
import { Link } from "expo-router";
|
||||
import React from "react";
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
||||
|
||||
const FilmItem: React.FC<{ item: Film }> = ({ item }) => {
|
||||
const id = item.url.split("/").filter(Boolean).pop();
|
||||
return (
|
||||
<Link href={`/films/${id}`} asChild>
|
||||
<TouchableOpacity>
|
||||
<View style={styles.filmItem}>
|
||||
<Text style={styles.title}>{item.title}</Text>
|
||||
<Text style={styles.details}>Episode: {item.episode_id}</Text>
|
||||
<Text style={styles.details}>Released: {item.release_date}</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
export default FilmItem;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
filmItem: {
|
||||
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",
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import { COLORS } from "@/constants/colors";
|
||||
import React from "react";
|
||||
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
|
||||
|
||||
interface Props {
|
||||
loading: boolean;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
const ListEmptyComponent = ({ loading, message = "No items found" }: Props) => {
|
||||
return (
|
||||
<View style={styles.emptyContainer}>
|
||||
{loading ? (
|
||||
<ActivityIndicator size={"large"} color={COLORS.text} />
|
||||
) : (
|
||||
<Text style={styles.emptyText}>{message}</Text>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default ListEmptyComponent;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
emptyContainer: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
height: 200,
|
||||
},
|
||||
emptyText: {
|
||||
fontSize: 18,
|
||||
color: COLORS.inactive,
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
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",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user