66 lines
1.7 KiB

import React from "react";
import { View, Pressable, Image, Dimensions, Text } from "react-native";
import { useNavigation } from "@react-navigation/native";
import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
const { width } = Dimensions.get("window");
import Header from "../../Home/components/Header";
const NewestVideo = ({ videos, grades }) => {
const navigation = useNavigation();
const Video = ({ video }) => {
return (
<Pressable
style={[
{
width: width / 2.3,
},
tw("flex flex-col items-end mb-4"),
]}
onPress={() => navigation.navigate("Video", { id: video.id })}
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
style={[
tw("rounded-md"),
{ width: "100%", height: ((width / 2.5) * 3) / 4 },
]}
/>
<Text
style={{
fontSize: fontSize.base,
marginTop: 5,
color: "#05335F",
fontFamily: "bold",
}}
>
{video.name}
</Text>
<Text
style={{
color: "#196EC0",
fontFamily: "light",
fontSize: fontSize.sm,
marginTop: 5,
}}
>
{"پایه" + " " + grades[video.gradeId]}
</Text>
</Pressable>
);
};
return (
<View style={tw("w-full flex flex-col w-full")}>
<Header title="جدیدترین دورهها" />
<View style={tw("w-full flex flex-row flex-wrap justify-between mt-3")}>
{videos.map((video, index) => (
<Video video={video} key={index} />
))}
</View>
</View>
);
};
export default NewestVideo;