From 8def998432d40c70415dad2133e26355f0ddcfad Mon Sep 17 00:00:00 2001 From: anperederi Date: Sat, 3 Feb 2024 14:07:28 +0100 Subject: [PATCH] update UI --- src/tp-react-native/components/JokeListItem.tsx | 14 +++++++++----- src/tp-react-native/model/CustomJoke.ts | 10 +--------- src/tp-react-native/model/Joke.ts | 2 +- src/tp-react-native/model/SampleJoke.ts | 8 -------- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/tp-react-native/components/JokeListItem.tsx b/src/tp-react-native/components/JokeListItem.tsx index 272c9f6..35e20c9 100644 --- a/src/tp-react-native/components/JokeListItem.tsx +++ b/src/tp-react-native/components/JokeListItem.tsx @@ -2,6 +2,7 @@ import {StyleSheet, Text, View, FlatList, Image} from 'react-native'; import {SampleJoke} from "../model/SampleJoke"; import {CustomJoke} from "../model/CustomJoke"; import {darksalmonColor, whiteColor, greyColor, indigoColor} from "../assets/Theme"; +import {Colors} from "react-native/Libraries/NewAppScreen"; type JokeListItemProps = { jokes: CustomJoke[] | SampleJoke[]; @@ -13,10 +14,10 @@ export default function JokeListItem(props: JokeListItemProps) { - {item.id} + Résumé de la blague {item.description()} - {item.type} + {item.type} @@ -67,11 +68,14 @@ const styles = StyleSheet.create({ color:whiteColor, paddingBottom: 7, paddingTop: 7, + fontSize: 16, }, bottomContainer: { backgroundColor: greyColor, - width:"auto", - height: 15, - borderRadius: 5 + paddingVertical: 5, + paddingHorizontal: 10, + borderRadius: 20, + width : 150, + alignItems : 'center' } }); \ No newline at end of file diff --git a/src/tp-react-native/model/CustomJoke.ts b/src/tp-react-native/model/CustomJoke.ts index 1561bec..3dba69c 100644 --- a/src/tp-react-native/model/CustomJoke.ts +++ b/src/tp-react-native/model/CustomJoke.ts @@ -41,12 +41,4 @@ export class CustomJoke extends Joke { set id(id: string) { 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}`; - } -} +} \ No newline at end of file diff --git a/src/tp-react-native/model/Joke.ts b/src/tp-react-native/model/Joke.ts index 6ba180d..237e81b 100644 --- a/src/tp-react-native/model/Joke.ts +++ b/src/tp-react-native/model/Joke.ts @@ -104,6 +104,6 @@ export abstract class Joke { * @return {string} Une description textuelle de la blague. */ public description(): string { - return this.type + this.summary; + return this.type + this.summary(); } } \ No newline at end of file diff --git a/src/tp-react-native/model/SampleJoke.ts b/src/tp-react-native/model/SampleJoke.ts index cb8e157..df11831 100644 --- a/src/tp-react-native/model/SampleJoke.ts +++ b/src/tp-react-native/model/SampleJoke.ts @@ -41,12 +41,4 @@ export class SampleJoke extends Joke { set id(id: number) { 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}`; - } } \ No newline at end of file