Skip to content

Commit f64df48

Browse files
committed
fix: ajustes no projeto
1 parent a677818 commit f64df48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+54669
-213
lines changed

aula_04_1_olamundo/package-lock.json

Lines changed: 221 additions & 212 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aula_04_1_olamundo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"expo-status-bar": "~1.6.0",
1515
"react": "18.2.0",
1616
"react-dom": "18.2.0",
17-
"react-native": "0.72.6",
17+
"react-native": "0.72.10",
1818
"react-native-web": "~0.19.6"
1919
},
2020
"devDependencies": {

e-commerce/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
11+
# Native
12+
*.orig.*
13+
*.jks
14+
*.p8
15+
*.p12
16+
*.key
17+
*.mobileprovision
18+
19+
# Metro
20+
.metro-health-check*
21+
22+
# debug
23+
npm-debug.*
24+
yarn-debug.*
25+
yarn-error.*
26+
27+
# macOS
28+
.DS_Store
29+
*.pem
30+
31+
# local env files
32+
.env*.local
33+
34+
# typescript
35+
*.tsbuildinfo

e-commerce/App.js

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
import React, { useState } from 'react';
2+
import { View, Text, Image, Dimensions, StyleSheet, Button, FlatList, SafeAreaView, Pressable } from 'react-native';
3+
import Icon from 'react-native-vector-icons/FontAwesome';
4+
5+
const App = () => {
6+
const [carouselEntries, setCarouselEntries] = useState([
7+
{ title: 'Playstation 5', image: require('./assets/ps5.png') },
8+
{ title: 'XBox Series X', image: require('./assets/xbox.png') },
9+
{ title: 'Nintendo Switch OLED', image: require('./assets/nintendo.png') },
10+
]);
11+
12+
const [listEntries, setListEntries] = useState([
13+
{ title: 'Playstation 5', image: require('./assets/ps5.png'), price: 'R$ 5000,00' },
14+
{ title: 'Playstation 5', image: require('./assets/ps5.png'), price: 'R$ 5000,00' },
15+
{ title: 'Playstation 5', image: require('./assets/ps5.png'), price: 'R$ 5000,00' },
16+
{ title: 'XBox Series X', image: require('./assets/xbox.png'), price: 'R$ 4500,00' },
17+
{ title: 'XBox Series X', image: require('./assets/xbox.png'), price: 'R$ 4500,00' },
18+
{ title: 'XBox Series X', image: require('./assets/xbox.png'), price: 'R$ 4500,00' },
19+
{ title: 'Nintendo Switch OLED', image: require('./assets/nintendo.png'), price: 'R$ 4000,00' },
20+
{ title: 'Nintendo Switch OLED', image: require('./assets/nintendo.png'), price: 'R$ 4000,00' },
21+
{ title: 'Nintendo Switch OLED', image: require('./assets/nintendo.png'), price: 'R$ 4000,00' },
22+
{ title: 'Final Fantasy 7 Rebirth', image: require('./assets/ff7.png'), price: 'R$ 400,00' },
23+
{ title: 'Final Fantasy 7 Rebirth', image: require('./assets/ff7.png'), price: 'R$ 400,00' },
24+
{ title: 'Final Fantasy 7 Rebirth', image: require('./assets/ff7.png'), price: 'R$ 400,00' },
25+
{ title: 'Final Fantasy 7 Rebirth', image: require('./assets/ff7.png'), price: 'R$ 400,00' },
26+
]);
27+
28+
const PressableButton = ({ onPress, title, style }) => {
29+
return (
30+
<Pressable style={style} onPress={onPress}>
31+
<Text style={styles.buttonText}>{title}</Text>
32+
</Pressable>
33+
);
34+
}
35+
36+
const renderItem = ({item, index}) => {
37+
return (
38+
<View style={[styles.item, {borderWidth: 1, borderColor: 'black'}]}>
39+
<Image source={item.image} style={styles.image} />
40+
<Text style={styles.title}>{ item.title }</Text>
41+
<PressableButton title="Comprar agora"
42+
onPress={() => console.log(`Comprado: ${item.title}`)}
43+
style={styles.button}/>
44+
</View>
45+
);
46+
}
47+
48+
const renderSecondItem = ({item, index}) => {
49+
return (
50+
<View style={styles.secondItem}>
51+
<Image source={item.image} style={styles.secondImage} />
52+
<Text style={styles.price}>{ item.price }</Text>
53+
<Icon name="shopping-cart" size={30} color="#000" />
54+
<PressableButton title="Comprar agora"
55+
onPress={() => console.log(`Comprado: ${item.title}`)}
56+
style={styles.button}/>
57+
</View>
58+
);
59+
}
60+
61+
return (
62+
<SafeAreaView style={styles.container}>
63+
<View style={styles.carouselContainer}>
64+
<FlatList
65+
data={carouselEntries}
66+
renderItem={renderItem}
67+
horizontal={true}
68+
pagingEnabled={true}
69+
showsHorizontalScrollIndicator={true}
70+
/>
71+
</View>
72+
<View style={styles.listContainer}>
73+
<FlatList
74+
data={listEntries}
75+
renderItem={renderSecondItem}
76+
keyExtractor={(item, index) => index.toString()}
77+
/>
78+
</View>
79+
</SafeAreaView>
80+
);
81+
}
82+
83+
const styles = StyleSheet.create({
84+
item: {
85+
backgroundColor: 'floralwhite',
86+
borderRadius: 5,
87+
height: 300,
88+
padding: 5,
89+
marginLeft: 10,
90+
marginRight: 10,
91+
marginTop: 10,
92+
width: Dimensions.get('window').width - 20
93+
},
94+
button: {
95+
backgroundColor: '#000',
96+
padding: 10,
97+
borderRadius: 5,
98+
shadowColor: "#000",
99+
shadowOffset: {
100+
width: 0,
101+
height: 2,
102+
},
103+
shadowOpacity: 0.25,
104+
shadowRadius: 3.84,
105+
elevation: 5,
106+
},
107+
buttonText: {
108+
color: '#fff',
109+
textAlign: 'center',
110+
},
111+
image: {
112+
width: 200,
113+
height: 200,
114+
alignSelf: 'center'
115+
},
116+
title: {
117+
fontSize: 20
118+
},
119+
secondItem: {
120+
flexDirection: 'row',
121+
justifyContent: 'space-between',
122+
alignItems: 'center',
123+
padding: 10,
124+
borderWidth: 1,
125+
borderColor: 'black',
126+
marginLeft: 10,
127+
marginRight: 10,
128+
marginTop: 10,
129+
width: Dimensions.get('window').width - 20
130+
},
131+
secondImage: {
132+
width: 50,
133+
height: 50
134+
},
135+
price: {
136+
fontSize: 20
137+
},
138+
container: {
139+
flex: 1,
140+
flexDirection: 'column',
141+
},
142+
carouselContainer: {
143+
flex: 1,
144+
borderWidth: 1
145+
},
146+
listContainer: {
147+
flex: 1
148+
}
149+
});
150+
151+
export default App;

e-commerce/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Sample Snack app
2+
3+
Open the `App.js` file to start writing some code. You can preview the changes directly on your phone or tablet by scanning the **QR code** or use the iOS or Android emulators. When you're done, click **Save** and share the link!
4+
5+
When you're ready to see everything that Expo provides (or if you want to use your own editor) you can **Download** your project and use it with [expo cli](https://docs.expo.dev/get-started/installation/#expo-cli)).
6+
7+
All projects created in Snack are publicly available, so you can easily share the link to this project via link, or embed it on a web page with the `<>` button.
8+
9+
If you're having problems, you can tweet to us [@expo](https://twitter.com/expo) or ask in our [forums](https://forums.expo.dev/c/expo-dev-tools/61) or [Discord](https://chat.expo.dev/).
10+
11+
Snack is Open Source. You can find the code on the [GitHub repo](https://github.com/expo/snack).

e-commerce/app.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"expo": {
3+
"name": "e-commerce",
4+
"slug": "snack-db948e56-6a1f-49a9-81a2-ee8aecc93861",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"assetBundlePatterns": [
15+
"**/*"
16+
],
17+
"ios": {
18+
"supportsTablet": true
19+
},
20+
"android": {
21+
"adaptiveIcon": {
22+
"foregroundImage": "./assets/adaptive-icon.png",
23+
"backgroundColor": "#ffffff"
24+
}
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
},
29+
"description": "Projeto criado usando o Github Copilot do Visual Studio Code"
30+
}
31+
}
17.1 KB
Loading

e-commerce/assets/favicon.png

1.43 KB
Loading

e-commerce/assets/ff7.png

113 KB
Loading

e-commerce/assets/icon.png

21.9 KB
Loading

0 commit comments

Comments
 (0)