diff --git a/LeftOvers/App.js b/LeftOvers/App.js index 030483c..7c5d287 100644 --- a/LeftOvers/App.js +++ b/LeftOvers/App.js @@ -1,6 +1,7 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; -import RecipeElementImage from './components/RecipeElementImage'; +import RecipeElement from './components/RecipeElement'; +import RecipeElementReduce from './components/RecipeElementReduce'; const generateImageList = () => { const imageList = []; @@ -16,7 +17,13 @@ export default function App() { return ( - + + + + ); } diff --git a/LeftOvers/components/Normalize.tsx b/LeftOvers/components/Normalize.tsx new file mode 100644 index 0000000..b328a11 --- /dev/null +++ b/LeftOvers/components/Normalize.tsx @@ -0,0 +1,17 @@ +import { Dimensions, Platform, PixelRatio } from 'react-native'; + +const { + width: SCREEN_WIDTH, +} = Dimensions.get('window'); + +const scale = SCREEN_WIDTH / 480; + +// @ts-ignore +export default function normalize(size) { + const newSize = size * scale + if (Platform.OS === 'ios') { + return Math.round(PixelRatio.roundToNearestPixel(newSize)) + } else { + return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 3 + } +} \ No newline at end of file diff --git a/LeftOvers/components/RecipeElementImage.tsx b/LeftOvers/components/RecipeElement.tsx similarity index 85% rename from LeftOvers/components/RecipeElementImage.tsx rename to LeftOvers/components/RecipeElement.tsx index f869d72..b7925e9 100644 --- a/LeftOvers/components/RecipeElementImage.tsx +++ b/LeftOvers/components/RecipeElement.tsx @@ -1,19 +1,21 @@ import React from 'react'; -import {StyleSheet,Pressable, Text, View, Image} from 'react-native'; +import {StyleSheet,Pressable, Text, View, Image, SafeAreaView, ScrollView} from 'react-native'; import brochette from '../assets/images/brochette.png'; import Union_left from '../assets/images/Union_left.png'; import Union_right from '../assets/images/Union_right.png'; import background from '../assets/images/Background.png'; +import normalize from './Normalize'; -interface recipeElementImageProps { +interface recipeElementProps { number : number title : string description : string imageList : string[] + image : string } -export default function RecipeElementImage(props : any) { +export default function RecipeElement(props : any) { return ( @@ -35,14 +37,19 @@ export default function RecipeElementImage(props : any) { - {props.description} - + + + {props.description} + + + ); } + const styles = StyleSheet.create({ button: { alignItems: 'center', diff --git a/LeftOvers/components/RecipeElementReduce.tsx b/LeftOvers/components/RecipeElementReduce.tsx new file mode 100644 index 0000000..b4d7920 --- /dev/null +++ b/LeftOvers/components/RecipeElementReduce.tsx @@ -0,0 +1,85 @@ +import React from 'react'; +import {StyleSheet,Pressable, Text, View, Image} from 'react-native'; +import brochette from '../assets/images/brochette.png'; +import Union_left from '../assets/images/Union_left.png'; +import Union_right from '../assets/images/Union_right.png'; +import background from '../assets/images/Background.png'; +import normalize from './Normalize'; + + +interface recipeElementReduceProps { + number : number + title : string + image : string + duree : string +} + +export default function RecipeElementReduce(props : any) { + return ( + + + {props.number} + {props.title} + + + + {props.duree} + + + + ); +} + + +const styles = StyleSheet.create({ + button: { + alignItems: 'center', + justifyContent: 'center', + width : 250, + height: 250, + borderRadius: 40, + elevation: 3, + backgroundColor: '#E3DEC9', + }, + text: { + fontSize: 14, + lineHeight: 21, + fontWeight: 'bold', + letterSpacing: 0.25, + color: '#756C28', + marginTop: 10, + }, + smallText: { + position: 'absolute', + textAlign: 'center', + left: 0, + right: 0, + marginHorizontal: 'auto', + color: '#E3DEC9', + + }, + title:{ + fontSize: 18, + lineHeight: 21, + fontWeight: 'bold', + letterSpacing: 0.25, + color: '#524B1A', + }, + view: { + width : 240, + height: 240, + borderRadius: 40, + elevation: 3, + borderWidth: 2, + borderColor: 'grey', + alignItems: 'center', // Centre le contenu verticalement + display: "flex", + flexWrap: "wrap", + }, + horizontalAlignement: { + display: "flex", + flexDirection : 'row', + alignItems: 'center', + marginTop: 10, + } +}); \ No newline at end of file diff --git a/LeftOvers/screens/RecipeSuggestion.tsx b/LeftOvers/screens/RecipeSuggestion.tsx new file mode 100644 index 0000000..e69de29