-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Feature/spike/global page #6
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d84c307
feat: Add multiple features to App component
Thomlam fef8ec6
remove test uri
Thomlam e02ccc1
Lint: Fix all sonar errors
Loule95450 e24089b
Update src/App.tsx
Loule95450 559c349
Merge branch 'develop' into feature/spike/globalPage
Loule95450 4c5c996
Create package-lock.json
Loule95450 8210391
Update App.tsx
Loule95450 ed08725
Run ESLint
Loule95450 cdfeec2
Lint fix
Loule95450 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import {SafeAreaView, StyleSheet, ScrollView} from 'react-native'; | ||
import NutritionInfo from './NutritionInfo'; | ||
|
||
const fakeApiData = { | ||
product_name: 'Ourson Chocolat', | ||
ingredients_text: 'Cacao, sucre, lait', | ||
nutriments: { | ||
carbohydrates: 54, | ||
proteins: 7, | ||
fat: 30, | ||
sugars: 100, | ||
salt: 0.2, | ||
}, | ||
ecoscore_score: '75', | ||
nutriscore_grade: 'B', | ||
}; | ||
|
||
const App = () => { | ||
return ( | ||
<SafeAreaView style={styles.screen}> | ||
<ScrollView contentContainerStyle={styles.content}> | ||
<NutritionInfo data={fakeApiData} /> | ||
</ScrollView> | ||
</SafeAreaView> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
screen: { | ||
flex: 1, | ||
backgroundColor: 'white', | ||
}, | ||
content: { | ||
padding: 20, | ||
}, | ||
}); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import {View, Text, StyleSheet} from 'react-native'; | ||
|
||
const NutritionInfo = ({data}) => { | ||
const { | ||
product_name, | ||
ingredients_text, | ||
nutriments, | ||
ecoscore_score, | ||
nutriscore_grade, | ||
} = data; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.title}>{product_name}</Text> | ||
<Text style={styles.subtitle}>Ingrédients: {ingredients_text}</Text> | ||
<View style={styles.section}> | ||
<Text style={styles.sectionTitle}>Informations Nutritionnelles:</Text> | ||
<Text>Carbohydrates: {nutriments.carbohydrates}g</Text> | ||
<Text>Protéines: {nutriments.proteins}g</Text> | ||
<Text>Graisses: {nutriments.fat}g</Text> | ||
<Text>Sucres: {nutriments.sugars}g</Text> | ||
<Text>Sel: {nutriments.salt}g</Text> | ||
</View> | ||
<View style={styles.section}> | ||
<Text style={styles.sectionTitle}>Scores:</Text> | ||
<Text>Eco-Score: {ecoscore_score}</Text> | ||
<Text>Nutri-Score: {nutriscore_grade}</Text> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
padding: 20, | ||
}, | ||
title: { | ||
fontSize: 18, | ||
fontWeight: 'bold', | ||
}, | ||
subtitle: { | ||
fontSize: 14, | ||
marginVertical: 10, | ||
}, | ||
section: { | ||
marginVertical: 10, | ||
}, | ||
sectionTitle: { | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
export default NutritionInfo; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / ESLint
disallow unused variables Error