parent
8667e32d67
commit
f6955073f0
12 changed files with 330 additions and 14 deletions
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,148 @@ |
||||
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; |
Loading…
Reference in new issue