Skip to content

Commit 28c30b9

Browse files
committed
continuação mobile
1 parent 8b57507 commit 28c30b9

File tree

11 files changed

+70
-5
lines changed

11 files changed

+70
-5
lines changed
144 KB
Loading

frontend/src/assets/logo.png

4.68 KB
Loading

frontend/src/assets/logo@2x.png

9.61 KB
Loading

frontend/src/assets/logo@3x.png

15.2 KB
Loading

frontend/src/services/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
const api = axios.create({
4-
baseURL: "http://10.0.0.40:3333",
4+
baseURL: "http://n-b490-iago:3333",
55
});
66

77
export default api;

mobile/assets/logo.png

4.68 KB
Loading

mobile/assets/logo@2x.png

9.61 KB
Loading

mobile/assets/logo@3x.png

15.2 KB
Loading

mobile/src/components/SpotList.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React, {useEffect, useState} from 'react';
2+
import {View, Text, StyleSheet} from 'react-native';
3+
4+
import api from '../services/api';
5+
6+
export default function Spotlist({tech}){
7+
const [spots, setSpots] = useState([]);
8+
9+
useEffect(() => {
10+
async function loadSpots(){
11+
const response = await api.get('/spots', {
12+
params: {tech}
13+
})
14+
setSpots(response.data);
15+
}
16+
loadSpots();
17+
}, []);
18+
19+
return (
20+
<View style={styles.container}>
21+
<Text style={styles.title}>Empresas que usam <Text style={styles.bold}>{tech}</Text></Text>
22+
</View>
23+
);
24+
25+
}
26+
27+
const styles = StyleSheet.create({
28+
container: {
29+
marginTop: 30,
30+
31+
},
32+
33+
title:{
34+
fontSize: 20,
35+
color: '#444',
36+
paddingHorizontal: 20,
37+
marginBottom: 15,
38+
},
39+
40+
bold: {
41+
fontWeight: 'bold',
42+
},
43+
});

mobile/src/page/List.js

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React, { useState, useEffect } from 'react';
2-
import { View, AsyncStorage, Text } from 'react-native';
2+
import { SafeAreaView, StyleSheet, AsyncStorage, Image, Text } from 'react-native';
3+
4+
import SpotList from '../components/SpotList';
5+
import logo from '../assets/logo.png';
36

47
export default function List() {
58
const [techs, setTechs] = useState([]);
@@ -13,5 +16,24 @@ export default function List() {
1316
}, []);
1417

1518

16-
return <Text>{techs}</Text>
17-
}
19+
return (
20+
<SafeAreaView style={styles.container}>
21+
<Image source={logo} style={styles.logo}/>
22+
23+
{techs.map(tech => <SpotList key={tech} tech={tech} />)}
24+
</SafeAreaView>
25+
)
26+
}
27+
28+
const styles = StyleSheet.create({
29+
container: {
30+
flex: 1,
31+
},
32+
33+
logo: {
34+
height: 32,
35+
resizeMode: "contain",
36+
alignSelf: 'center',
37+
marginTop: 10
38+
},
39+
});

mobile/src/services/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
const api = axios.create({
4-
baseURL: 'http://10.0.0.40:3333',
4+
baseURL: 'http://n-b490-iago:3333',
55
});
66

77
export default api;

0 commit comments

Comments
 (0)