Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .expo-shared/assets.json

This file was deleted.

23 changes: 9 additions & 14 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import React from 'react';
import styled from 'styled-components/native';

const Container = styled.View`
flex: 1;
background-color: papayawhip;
justify-content: center;
align-items: center;
`;

const Title = styled.Text`
font-size: 24px;
color: palevioletred;
`;
import RandomQuote from './components/RandomQuote';

const App = () => {
return (
<Container>
<Title>This is your cool app!</Title>
<Title>Go to App.js and start coding</Title>
<Title>💅💅💅</Title>
<RandomQuote />
</Container>
Comment on lines 8 to 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and clean approach in app.js with only RandomQuote :)

);
};

const Container = styled.View`
flex: 1;
background-color: #3d405b;
justify-content: center;
align-items: center;
`;

export default App;
823 changes: 823 additions & 0 deletions albums.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions components/Albums.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import data from '../albums.json';
import React, { useEffect, useState } from 'react';
import { View, Text } from 'react-native';

const Albums = () => {
const [album, setAlbum] = useState({});
console.log(data.items[2].name);

const generateAlbum = () => {
fetch('../albums.json')
.then((res) => res.json())
.then((data) => setAlbum(data));
};

useEffect(() => {
generateAlbum();
});

return (
<View>
<Text>{JSON.stringify(data.items[2].name)} </Text>
</View>
);
};

export default Albums;
Comment on lines +1 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have missed this from the classes since we did not do the same project, but I can't see it imported somewhere so just wanted to comment in case it is not used :)

63 changes: 63 additions & 0 deletions components/RandomQuote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, { useState, useEffect } from 'react';
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';

const RandomQuote = () => {
const [quote, setQuote] = useState({});

const generateQuote = () => {
fetch('https://api.quotable.io/random')
.then((res) => res.json())
.then((data) => setQuote(data));
};

useEffect(() => {
generateQuote();
}, []);
Comment on lines +4 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well doe with the fetch, it works perfectly on my phone! : D


return (
<View style={styles.container}>
<TouchableOpacity style={styles.btn} onPress={generateQuote}>
<Text style={styles.btnText}>New Quote</Text>
</TouchableOpacity>
<Text style={styles.quote}>"{quote.content}"</Text>
<Text style={styles.author}>{quote.author}</Text>
</View>
);
};

Comment on lines +17 to +27
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job implementing the Stylesheet object for styling the fetched quotes and author now that we had the opportunity to try it! ^__^

const styles = StyleSheet.create({
container: {
padding: 30,
},
btn: {
alignItems: 'center',
backgroundColor: '#81b29a',
paddingVertical: 20,
paddingHorizontal: 30,
marginBottom: 10,
alignSelf: 'center',
borderRadius: 3,
},
btnText: {
color: '#f4f1de',
fontSize: 18,
textTransform: 'uppercase',
fontWeight: 'bold',
},
quote: {
color: '#f4f1de',
fontSize: 24,
fontStyle: 'italic',
textAlign: 'center',
margin: 20,
lineHeight: 30,
},
author: {
color: '#f4f1de',
textAlign: 'center',
fontSize: 18,
fontWeight: 'bold',
},
});

export default RandomQuote;
823 changes: 823 additions & 0 deletions data.json

Large diffs are not rendered by default.

Loading