pull/13/head
Tony Fages 5 months ago committed by Anthony RICHARD
parent 1f8a05d1da
commit 98c2bd72a2

@ -1,68 +1,73 @@
import {ImageBackground, Text, TouchableOpacity, View} from "react-native"; import { Workout } from "@/model/Workout";
import { AntDesign, MaterialCommunityIcons } from "@expo/vector-icons";
import React from "react"; import React from "react";
import {AntDesign, MaterialCommunityIcons} from "@expo/vector-icons"; import { ImageBackground, Text, TouchableOpacity, View } from "react-native";
import {Workout} from "@/model/Workout";
interface WorkoutCardComponentProps { interface WorkoutCardComponentProps {
exercise: Workout, exercise: Workout;
background?: String, background?: String;
height?: number, height?: number;
} }
export default function WorkoutCardComponent({exercise, height, background}: WorkoutCardComponentProps) { export default function WorkoutCardComponent({
exercise,
height,
background,
const style = () => { }: WorkoutCardComponentProps) {
return `rounded-2xl overflow-hidden ${background ?? "bg-black"}` const style = () => {
} return `rounded-2xl overflow-hidden ${background ?? "bg-black"}`;
};
const styleImage = () => {
return `w-full h-full `
}
console.log(styleImage())
console.log(style()) const styleImage = () => {
return `w-full h-full `;
};
return ( console.log(styleImage());
<View className={style()}>
console.log(style());
<ImageBackground return (
source={require("assets/images/Sigma-2.png")} <View className={style()}>
className='h-full w-full' <ImageBackground
> source={require("assets/images/Sigma-2.png")}
<View className="flex-row justify-between p-4"> className="h-full w-full"
<View className="flex-row space-x-4 h-44 items-top justify-center "> >
<View className="flex-row items-top"> <View className="flex-row justify-between p-4">
<Text className="text-white text-sm ml-1">{exercise.duration} min</Text> <View className="flex-row space-x-4 h-44 items-top justify-center ">
</View> <View className="flex-row items-top">
<View className="flex-row justify-center"> <Text className="text-white text-sm ml-1">
<MaterialCommunityIcons name="square-rounded" size={8} color="white"/> {exercise.duration} min
</View> </Text>
<View className="flex-row"> </View>
<Text className="text-white text-sm ml-1">{exercise.calories} kcal</Text> <View className="flex-row justify-center">
</View> <MaterialCommunityIcons
</View> name="square-rounded"
</View> size={8}
color="white"
<View className="absolute bottom-0 left-0 right-0 p-4 bg-opacity-50"> />
<Text className="text-white text-lg font-bold">{exercise.name}</Text> </View>
<Text className="text-gray-300 text-sm">{exercise.repetitions}</Text> <View className="flex-row">
<View className="flex-row items-center mt-2"> <Text className="text-white text-sm ml-1">
<Text className="text-white text-xs bg-gray-800 py-1 px-3 rounded-full"> {exercise.calories} kcal
{exercise.level} </Text>
</Text> </View>
</View> </View>
</View> </View>
<TouchableOpacity className="absolute bottom-2 right-4 p-4 rounded-full">
<AntDesign name="play" size={50} color="orange"/>
</TouchableOpacity>
</ImageBackground>
<View className="absolute bottom-0 left-0 right-0 p-4 bg-opacity-50">
<Text className="text-white text-lg font-bold">{exercise.name}</Text>
<Text className="text-gray-300 text-sm">{exercise.repetitions}</Text>
<View className="flex-row items-center mt-2">
<Text className="text-white text-xs bg-gray-800 py-1 px-3 rounded-full">
{exercise.level}
</Text>
</View>
</View> </View>
);
} <TouchableOpacity className="absolute bottom-2 right-4 p-4 rounded-full">
<AntDesign name="play" size={50} color="orange" />
</TouchableOpacity>
</ImageBackground>
</View>
);
}

Loading…
Cancel
Save