Update UI of the part2

Merge pull request 'update UI' (#2) from part2 into master
Reviewed-on: #2
pull/5/head^2
Antoine PEREDERII 1 year ago
commit dab1695919

@ -2,6 +2,7 @@ import {StyleSheet, Text, View, FlatList, Image} from 'react-native';
import {SampleJoke} from "../model/SampleJoke"; import {SampleJoke} from "../model/SampleJoke";
import {CustomJoke} from "../model/CustomJoke"; import {CustomJoke} from "../model/CustomJoke";
import {darksalmonColor, whiteColor, greyColor, indigoColor} from "../assets/Theme"; import {darksalmonColor, whiteColor, greyColor, indigoColor} from "../assets/Theme";
import {Colors} from "react-native/Libraries/NewAppScreen";
type JokeListItemProps = { type JokeListItemProps = {
jokes: CustomJoke[] | SampleJoke[]; jokes: CustomJoke[] | SampleJoke[];
@ -13,10 +14,10 @@ export default function JokeListItem(props: JokeListItemProps) {
<View style={styles.color}/> <View style={styles.color}/>
<Image source={{ uri: item.image }} style={styles.image} /> <Image source={{ uri: item.image }} style={styles.image} />
<View style={styles.columnContainer}> <View style={styles.columnContainer}>
<Text style={styles.text}>{item.id}</Text> <Text style={styles.text}>Résumé de la blague</Text>
<Text style={styles.text}>{item.description()}</Text> <Text style={styles.text}>{item.description()}</Text>
<View style={styles.bottomContainer}> <View style={styles.bottomContainer}>
<Text style={styles.text}>{item.type}</Text> <Text style={{color:'white'}}>{item.type}</Text>
</View> </View>
</View> </View>
</View> </View>
@ -67,11 +68,14 @@ const styles = StyleSheet.create({
color:whiteColor, color:whiteColor,
paddingBottom: 7, paddingBottom: 7,
paddingTop: 7, paddingTop: 7,
fontSize: 16,
}, },
bottomContainer: { bottomContainer: {
backgroundColor: greyColor, backgroundColor: greyColor,
width:"auto", paddingVertical: 5,
height: 15, paddingHorizontal: 10,
borderRadius: 5 borderRadius: 20,
width : 150,
alignItems : 'center'
} }
}); });

@ -41,12 +41,4 @@ export class CustomJoke extends Joke {
set id(id: string) { set id(id: string) {
this._id = id; this._id = id;
} }
/**
* @brief Obtient une description textuelle de la blague.
* @return {string} La description de la blague.
*/
description(): string {
return `ID: ${this.id}, Setup: ${this.setup}, Punchline: ${this.punchline}`;
}
} }

@ -104,6 +104,6 @@ export abstract class Joke {
* @return {string} Une description textuelle de la blague. * @return {string} Une description textuelle de la blague.
*/ */
public description(): string { public description(): string {
return this.type + this.summary; return this.type + this.summary();
} }
} }

@ -41,12 +41,4 @@ export class SampleJoke extends Joke {
set id(id: number) { set id(id: number) {
this._id = id; this._id = id;
} }
/**
* @brief Obtient une description textuelle de la blague d'échantillon.
* @return {string} Une description textuelle de la blague d'échantillon.
*/
description(): string {
return `ID: ${this.id}, Setup: ${this.setup}, Punchline: ${this.punchline}`;
}
} }
Loading…
Cancel
Save