-
Notifications
You must be signed in to change notification settings - Fork 311
Techy API React Native #309
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
Open
Laura-Sjolander
wants to merge
9
commits into
Technigo:master
Choose a base branch
from
Laura-Sjolander:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
55f1d1d
app is working, fetching from api
Laura-Sjolander 5091fe2
styled components
Laura-Sjolander dbf28c5
solved issue with styled component
Laura-Sjolander 03ce5b7
added image as styled component
Laura-Sjolander 5b88b8b
cleaned up code and styled techy quote
Laura-Sjolander d90249b
deleted pictures not used
Laura-Sjolander 6fbb039
added adaptive icon again
Laura-Sjolander 390d408
fixes after code review
Laura-Sjolander 56fdc1c
Update README.md
Laura-Sjolander 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| # Project React Native App 📱 | ||
|
|
||
| Replace this readme with your own information about your project. | ||
|
|
||
| Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. | ||
| This week we should build a mobile app. | ||
| We had one week to be done with the assignment and learn all the new tools used. | ||
|
|
||
| ## The problem | ||
|
|
||
| Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? | ||
| I found an API that I wanted to use. I used styled components and had a button with TouchableOpacity to generate the technical quotes from the API. | ||
|
|
||
| ## View it live | ||
| You can see the app here: | ||
| https://snack.expo.dev/@sjolanders/native-app | ||
|
|
||
| Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about. |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ | |
| } | ||
| }, | ||
| "web": { | ||
| "favicon": "./assets/favicon.png" | ||
| "favicon": "./assets/favicon.png" | ||
| } | ||
| } | ||
| } | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,57 @@ | ||
| import React, { useState, useEffect } from 'react'; | ||
| import { Text } from 'react-native'; | ||
| 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; | ||
|
|
||
| `; | ||
|
|
||
| const Quote = styled.Text` | ||
| font-size: 15px; | ||
| color: black; | ||
| font-style: italic; | ||
| `; | ||
|
|
||
| const APIButton= styled.TouchableOpacity` | ||
| font-weight: 700; | ||
| width: 40%; | ||
| background-color: lightgrey; | ||
| margin-top: 20px; | ||
| border-radius: 10px; | ||
| border: 2px solid darkgrey; | ||
| padding: 5px; | ||
| `; | ||
|
|
||
|
|
||
| useEffect(() => { | ||
| generateTechWords(); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Container> | ||
| <Quote> | ||
| {techwords.message}</Quote> | ||
| <APIButton onPress={generateTechWords}> | ||
| <Text>New sentence</Text> | ||
| </APIButton> | ||
| </Container> | ||
| ) | ||
| } | ||
|
|
||
| export default TechyApi; | ||
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.
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.
Great that you made it work!
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.
😊