-
Notifications
You must be signed in to change notification settings - Fork 313
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
Techy API React Native #309
base: master
Are you sure you want to change the base?
Changes from 7 commits
55f1d1d
5091fe2
dbf28c5
03ce5b7
5b88b8b
d90249b
6fbb039
390d408
56fdc1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,48 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components/native'; | ||
import TechyApi from './components/TechyApi'; | ||
import { ImageBackground } from 'react-native'; | ||
|
||
const Container = styled.View` | ||
flex: 1; | ||
background-color: papayawhip; | ||
justify-content: center; | ||
align-items: center; | ||
`; | ||
margin-top: 20px; | ||
`; | ||
|
||
const Title = styled.Text` | ||
font-size: 24px; | ||
color: palevioletred; | ||
font-size: 20px; | ||
color: darkgreen; | ||
`; | ||
|
||
const ContainerText = styled.View` | ||
flex: 1; | ||
justify-content: center; | ||
align-items: center; | ||
width: 80%; | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
padding-top: 20px; | ||
`; | ||
|
||
const Technician = styled.Image` | ||
width: 40%; | ||
height: 40%; | ||
background: black; | ||
margin-top: 20px; | ||
padding: 10px; | ||
`; | ||
|
||
const App = () => { | ||
return ( | ||
<Container> | ||
<Title>This is your cool app!</Title> | ||
<Title>Go to App.js and start coding</Title> | ||
<Title>💅💅💅</Title> | ||
<Technician source={require('./assets/technicians-at-work.jpg')} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great that you made it work! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😊 |
||
<ContainerText> | ||
<Title>Want to sound like you know what you are talking about? | ||
Try these techy expressions: | ||
👩💻👩💻👩💻</Title> | ||
</ContainerText> | ||
<TechyApi/> | ||
</Container> | ||
); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
} | ||
}, | ||
"web": { | ||
"favicon": "./assets/favicon.png" | ||
"favicon": "./assets/favicon.png" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { View, Text, TouchableOpacity } from 'react-native'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
import styled from 'styled-components/native'; | ||
|
||
const TechyApi = () => { | ||
const [techwords, setTechwords] = useState({}) | ||
|
||
const generateTechWords = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice API, I should try to learn some sentences ;) |
||
fetch('https://techy-api.vercel.app/api/json') | ||
.then(response => response.json()) | ||
.then((data) => setTechwords(data)) | ||
} | ||
|
||
const Container = styled.View` | ||
flex: 1; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 20px; | ||
width: 80%; | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's just github that does that, but it seems that the indentation isn't right in some places, like here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its Github for sure, it doesn´t look like this in VSC :) |
||
|
||
const Quote = styled.Text` | ||
font-size: 15px; | ||
color: black; | ||
font-style: italic; | ||
`; | ||
|
||
const APIButton= styled.TouchableOpacity` | ||
font-weight: 700; | ||
width: 40%; | ||
background-color: green; | ||
margin-top: 20px; | ||
border-radius: 10px; | ||
border: 2px solid darkgreen; | ||
padding; 5px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your padding isn't applied here because you have a semi-colon instead of a colon, should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! It´s the little things...right 😊 |
||
color: white; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property has no effect (you text on the button remains black), since you are trying to set a font color to a container. Try to apply this to |
||
`; | ||
|
||
|
||
useEffect(() => { | ||
generateTechWords(); | ||
}, []); | ||
|
||
return ( | ||
<Container> | ||
<Quote> | ||
{techwords.message}</Quote> | ||
<APIButton onPress={generateTechWords}> | ||
<Text>New sentence</Text> | ||
</APIButton> | ||
</Container> | ||
) | ||
} | ||
|
||
export default TechyApi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could remove this line, since it's not used.