You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

148 lines
3.9 KiB

import React, { useState } from "react";
import {
View,
Text,
Dimensions,
Pressable,
TouchableOpacity,
} from "react-native";
import tw from "tailwind-rn";
import Colors from "../../../constants/Colors";
const { width, height } = Dimensions.get("window");
const Season = ({ season }) => {
const [activeSeason, setActiveSeason] = useState(null);
const Unit = ({ unit }) => {
return (
<View
style={[
tw("w-full flex flex-col rounded-md overflow-hidden mb-3"),
{ borderWidth: 1, borderColor: Colors.theme1.light.blue3 },
]}
>
<View
style={[
tw(
"w-full flex flex-row-reverse justify-between items-center py-1.5 px-2"
),
{
borderBottomWidth: 1,
borderColor: Colors.theme1.light.blue3,
backgroundColor: Colors.theme1.light.blue8,
},
]}
>
<Text
style={[
{
fontFamily: "regular",
fontSize: width / 34,
color: Colors.theme1.light.blue5,
},
]}
>
{unit.name}
</Text>
<Text
style={[
{
fontFamily: "regular",
fontSize: width / 36,
color: Colors.theme1.light.blue5,
},
]}
>
{unit.duration}
</Text>
</View>
<View style={[tw("w-full flex flex-row-reverse")]}>
{unit.play && (
<Pressable
style={[
tw("flex flex-1 flex-row items-center py-1.5 px-2"),
{
borderLeftWidth: 1,
borderColor: Colors.theme1.light.blue3,
backgroundColor: Colors.theme1.light.blue8,
},
]}
>
<Text
style={{
width: "100%",
textAlign: "center",
fontFamily: "regular",
fontSize: width / 34,
color: Colors.theme1.light.blue5,
}}
>
نمایش
</Text>
</Pressable>
)}
{unit.download && (
<Pressable
style={tw("flex flex-1 flex-row items-center py-1.5 px-2")}
>
<Text
style={{
width: "100%",
textAlign: "center",
fontFamily: "regular",
fontSize: width / 34,
color: Colors.theme1.light.blue5,
backgroundColor: Colors.theme1.light.blue8,
}}
>
دانلود
</Text>
</Pressable>
)}
</View>
</View>
);
};
return (
<View style={tw("w-full flex flex-col")}>
<TouchableOpacity
style={[
tw(
"flex flex-row-reverse justify-between items-center rounded-md py-2 px-3 mb-3"
),
{ backgroundColor: Colors.theme1.light.blue5 },
]}
onPress={() =>
setActiveSeason(season.name === activeSeason ? null : season.name)
}
>
<Text
style={[
{
fontFamily: "regular",
fontSize: width / 34,
color: "white",
},
]}
>
{season.name}
</Text>
<Text
style={[
{
fontFamily: "regular",
fontSize: width / 36,
color: "white",
},
]}
>
{season.duration}
</Text>
</TouchableOpacity>
{season.name === activeSeason &&
season.units.map((unit, index) => <Unit unit={unit} key={index} />)}
</View>
);
};
export default Season;