Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
32989f3
Renaming Error Color
FelipeLemos225 May 22, 2023
84d121c
Renaming some directories
FelipeLemos225 May 22, 2023
ed717d0
Instaling some libs and changing some paths names to correct errors.
FelipeLemos225 May 23, 2023
24baa15
Editing the GridCard component with APIb fetch whit axios
FelipeLemos225 May 23, 2023
1010f8a
Adding new styles to HomeScreen
FelipeLemos225 May 23, 2023
1352b1c
Adding New colors
FelipeLemos225 May 23, 2023
5292d95
Typing the Code.
FelipeLemos225 May 23, 2023
9b1bb61
Correcting the KeyExtractor to use the ID as exclusive key.
FelipeLemos225 May 23, 2023
69e4020
Creating the button component.
FelipeLemos225 May 23, 2023
b6bb883
Adding styles for button cards.
FelipeLemos225 May 23, 2023
b0a6d3c
Some Minor changes on text component.
FelipeLemos225 May 23, 2023
25c765b
Adding new colors
FelipeLemos225 May 23, 2023
fd8d548
Merge branch 'main' of https://github.com/GabrielMoraeswolf/loginComp…
GabrielMoraeswolf May 23, 2023
d43cef7
merging
GabrielMoraeswolf May 23, 2023
c9a660f
feat(new component): button buy component
ismaelkentenich May 23, 2023
baf951a
feat(new component): button 'arrow-back' component
ismaelkentenich May 23, 2023
975a7b8
cart button component
ismaelkentenich May 23, 2023
09cfea5
new Screen
GabrielMoraeswolf May 23, 2023
2c9d656
product
GabrielMoraeswolf May 23, 2023
7b2c591
removing stack navigation header
ismaelkentenich May 23, 2023
e3bc41f
api
GabrielMoraeswolf May 23, 2023
a0a52f1
adding SafeAreView
ismaelkentenich May 23, 2023
4fc770a
Merge branch 'components' into development
GabrielMoraeswolf May 23, 2023
4edc4a3
Merge branch 'development' into product
GabrielMoraeswolf May 23, 2023
d7eb3b8
Adding Icons Library
FelipeLemos225 May 23, 2023
7b2f171
Deleting Button to cards Component.
FelipeLemos225 May 23, 2023
6396575
Adding Favorite Button Component.
FelipeLemos225 May 23, 2023
38b6b42
Adding Price Card Component.
FelipeLemos225 May 23, 2023
4396e24
conection card
GabrielMoraeswolf May 23, 2023
5950b95
Adding The New Components to the GridCard Home Screen Component.
FelipeLemos225 May 23, 2023
82c4797
Adding New Styles for new Components.
FelipeLemos225 May 23, 2023
9f5216c
Editing Colors Archive.
FelipeLemos225 May 23, 2023
9874ae8
Merge to Development
FelipeLemos225 May 23, 2023
f12b506
packageJson
GabrielMoraeswolf May 23, 2023
12a4972
refactor
GabrielMoraeswolf May 23, 2023
1492719
adding tab bar
ismaelkentenich May 23, 2023
468fb90
tab bar effects
ismaelkentenich May 23, 2023
51cc223
tab bar style update
ismaelkentenich May 23, 2023
0ba690c
card router
GabrielMoraeswolf May 23, 2023
92d04ab
notification card
ismaelkentenich May 24, 2023
e467048
merge
ismaelkentenich May 24, 2023
3db222b
Correcting conflict with the branch.
FelipeLemos225 May 24, 2023
7d91936
Correcting error.
FelipeLemos225 May 24, 2023
0f0c20a
Merge branch 'development' of https://github.com/GabrielMoraeswolf/lo…
FelipeLemos225 May 24, 2023
5809e12
CartButton update
ismaelkentenich May 24, 2023
68a9e4e
Correcting some errors
FelipeLemos225 May 24, 2023
8bb84b2
update
ismaelkentenich May 24, 2023
bfe4590
merging components
ismaelkentenich May 24, 2023
b20862d
Merge branch 'home' of https://github.com/GabrielMoraeswolf/loginComp…
FelipeLemos225 May 24, 2023
8dd7f2d
creating cartScreen
ismaelkentenich May 24, 2023
1f959f1
delete useless past
GabrielMoraeswolf May 24, 2023
5525d72
refacture
GabrielMoraeswolf May 24, 2023
73fc084
_
GabrielMoraeswolf May 24, 2023
ab59d61
updating CartScreen layout
ismaelkentenich May 24, 2023
165dbf5
Merge branch 'CartScreen' into development
ismaelkentenich May 24, 2023
e1d7463
Merge branch 'home' into development
FelipeLemos225 May 24, 2023
2ffc0f2
teste
IagoVianaa May 24, 2023
57826b0
Merge branch 'development' of https://github.com/GabrielMoraeswolf/lo…
FelipeLemos225 May 24, 2023
8c263e0
t
IagoVianaa May 24, 2023
5b4b837
Merge branch 'cart' of https://github.com/GabrielMoraeswolf/loginComp…
IagoVianaa May 24, 2023
a7043d0
Adding description to cards.
FelipeLemos225 May 24, 2023
1c1c677
adding button on homepage
ismaelkentenich May 24, 2023
59c7bbc
Updating Color of FavoriteButton.
FelipeLemos225 May 24, 2023
d875f4d
Moving GridStyles from HomeScreen folder to a folder component
FelipeLemos225 May 24, 2023
7ffa797
Renaming HomeScreen.tsx to Index.tsx inside HomeScreen folder.
FelipeLemos225 May 24, 2023
20c38a0
Moving the styles of PriceCa.rd from HomeScreen styles to its own folder
FelipeLemos225 May 24, 2023
5f6db94
styles and layouts improvements
ismaelkentenich May 24, 2023
83b703d
Updating paths of HomeScreen to its new name Index.
FelipeLemos225 May 24, 2023
c6cb056
Updating styles from HomeScreen.
FelipeLemos225 May 24, 2023
72b3cc6
Adding a new color to FavoriteButton.
FelipeLemos225 May 24, 2023
1098550
update home style
ismaelkentenich May 24, 2023
9bfabe9
updating arrow
ismaelkentenich May 24, 2023
3727ddd
update
ismaelkentenich May 24, 2023
fd0c7fc
style updates
ismaelkentenich May 25, 2023
603670b
commit
ismaelkentenich May 25, 2023
d9dec05
estilizacao tela de Produtos
IagoVianaa May 25, 2023
57f23cb
home card images improvement
ismaelkentenich May 25, 2023
befdf58
navigation improvements
ismaelkentenich May 25, 2023
f048099
adding buttons to productscreen
ismaelkentenich May 25, 2023
bc5c480
updating
ismaelkentenich May 25, 2023
b5971c6
updating style
ismaelkentenich May 25, 2023
d7eaca0
productscreen update - quantity buttons
ismaelkentenich May 25, 2023
8ef1371
quantity button update
ismaelkentenich May 25, 2023
cac76e4
router Cart
GabrielMoraeswolf May 26, 2023
074e602
navigation with useContext
GabrielMoraeswolf May 26, 2023
53cad90
refacture
GabrielMoraeswolf May 26, 2023
d1d4544
merge context updates
ismaelkentenich May 26, 2023
63ec8cd
Resolving Merge to Development conflicts.
FelipeLemos225 May 26, 2023
15c74c8
commit
ismaelkentenich May 26, 2023
38de767
merging development with context upd
ismaelkentenich May 26, 2023
7ecd206
function sum price
GabrielMoraeswolf May 26, 2023
e0ddf58
cartButton dinamico
ismaelkentenich May 26, 2023
ea18dd8
build a empty screen
GabrielMoraeswolf May 26, 2023
50ad17b
Merge branch 'RoutScreen' into development
GabrielMoraeswolf May 26, 2023
2457f5a
creating remove button
ismaelkentenich May 26, 2023
817583d
Including Styles to CartScreen
FelipeLemos225 May 26, 2023
034a6dc
refactor
GabrielMoraeswolf May 26, 2023
273653b
refactor merge
GabrielMoraeswolf May 26, 2023
e2d6b71
notification alert on product screen
ismaelkentenich May 26, 2023
770223f
refacture
GabrielMoraeswolf May 26, 2023
6de0f26
quantity accepting zero
ismaelkentenich May 26, 2023
0866bbb
merge cartscreeen into development
ismaelkentenich May 26, 2023
de9fc03
Adding function to clear cart on the context.
FelipeLemos225 May 26, 2023
bdd28cb
refacture
GabrielMoraeswolf May 26, 2023
4e9ab9a
Resolving importing issues.
FelipeLemos225 May 26, 2023
b095d09
Adding the Alert from Cart Screen and cleaning the cart.
FelipeLemos225 May 26, 2023
8db33b5
adding multiple cards to cartScreen
ismaelkentenich May 26, 2023
07dbff3
remove button function
GabrielMoraeswolf May 26, 2023
8e03074
Merge branch 'development' of https://github.com/GabrielMoraeswolf/lo…
GabrielMoraeswolf May 26, 2023
a6bf7d3
Merge branch 'RoutScreen' into development
GabrielMoraeswolf May 26, 2023
a9398d2
refacture
GabrielMoraeswolf May 26, 2023
76c6793
refacture in merge
GabrielMoraeswolf May 26, 2023
4caf11b
CartScreen updates
ismaelkentenich May 26, 2023
170c0b1
CartScreen style update
ismaelkentenich May 26, 2023
19ec29f
update
ismaelkentenich May 27, 2023
9379df3
refacture code
GabrielMoraeswolf May 27, 2023
0bcb039
refacture merge
GabrielMoraeswolf May 27, 2023
df2beb0
build botton remove
GabrielMoraeswolf May 27, 2023
56fd4f8
unique
GabrielMoraeswolf May 27, 2023
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
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"Ionicons",
"Signup"
]
}
21 changes: 15 additions & 6 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@

import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import Navigation from './Navigation/Navigation'
import { View } from 'react-native';
import { SafeAreaView } from 'react-native';
import { Colors } from './styles';
import { CartProvider } from './Components/Context/CartContext';

const Stack = createNativeStackNavigator();


export default function App() {
return (
<>
<StatusBar style="light" />
<Navigation />
</>
<NavigationContainer>
<CartProvider>
<SafeAreaView style={{ flex: 1, backgroundColor: Colors.background}}>
<StatusBar style="light" />
{/* SO THE CONTENT WONT BE ABOVE STATUS BAR */}
<View style={{ marginTop: 23}}/>
<Navigation />
</SafeAreaView>
</CartProvider>
</NavigationContainer>
);
}
15 changes: 15 additions & 0 deletions Components/BackButton/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TouchableOpacity, View, Image, Pressable } from "react-native";
import styles from "./Styles";

function BackButton ({action}:any) {

return(
<View>
<TouchableOpacity onPress={action}>
<Image source={require('../../assets/arrow.png')} style={styles.arrowButton}/>
</TouchableOpacity>
</View>
);
}

export default BackButton;
11 changes: 11 additions & 0 deletions Components/BackButton/Styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { StyleSheet } from "react-native";

const styles = StyleSheet.create({
arrowButton: {
padding: 5,
width: 30,
resizeMode: 'contain',
},
});

export default styles
15 changes: 15 additions & 0 deletions Components/ButtonRemove/ButtonRemove.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { useContext } from 'react';
import { TouchableOpacity, View, Image, Text, StyleSheet } from 'react-native';
import styles from './Styles';

function ButtonRemove({ onPress }: any) {
return (
<TouchableOpacity onPress={onPress}>
<View style={styles.container}>
<Text style={styles.text}>-</Text>
</View>
</TouchableOpacity>
);
}

export default ButtonRemove;
29 changes: 29 additions & 0 deletions Components/ButtonRemove/Styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { StyleSheet } from "react-native";
import { Colors } from "../../styles";

const styles = StyleSheet.create({
container: {
position: 'absolute',
width: 50,
height: 50,
borderRadius: 25,
backgroundColor: Colors.removeButton,
justifyContent: 'center',
alignItems: 'center',
shadowColor: 'black',
shadowOffset: {width: 1, height: 2},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 2, //ANDROID
},
text:{
fontSize: 48,
fontWeight: '600',
color: Colors.cardTitle,
textAlign: 'center',
lineHeight: 52,
},

});

export default styles;
18 changes: 18 additions & 0 deletions Components/CartButton/CartButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { useContext } from 'react';
import { TouchableOpacity, View, Image, Text, StyleSheet } from 'react-native';
import styles from './Styles';
import { CartContext } from '../Context/CartContext';

function CartButton({ onPress, cartCount }: any) {
const cartCounter = useContext(CartContext);
return (
<TouchableOpacity onPress={onPress}>
<Image source={require('../../assets/cart-icon.png')} style={styles.cartButton} />
<View style={styles.badge}>
<Text style={styles.badgeText}>{cartCounter.cards.length}</Text>
</View>
</TouchableOpacity>
);
}

export default CartButton;
26 changes: 26 additions & 0 deletions Components/CartButton/Styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { StyleSheet } from "react-native";

const styles = StyleSheet.create({
cartButton: {
width: 28,
height: 28,
position: 'absolute'
},
badge: {
position: 'relative',
left: 17,
bottom: 4,
backgroundColor: 'green',
borderRadius: 10,
width: 15,
height: 15,
justifyContent: 'center',
alignItems: 'center',
},
badgeText: {
color: 'white',
fontSize: 9,
},
});

export default styles;
45 changes: 45 additions & 0 deletions Components/Context/CartContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { createContext, useState } from "react";

type CardData = {
id: number;
title: string;
price: number;
image: string;
description: string;
};

type CartContextType = {
cards: CardData[];
addCard: (card: CardData) => void;
removeCard: (cardId: number) => void;
clearCart: () => void;
};

export const CartContext = createContext<CartContextType>({
cards: [],
addCard: () => {},
removeCard: () => {},
clearCart: () => {},
});

export const CartProvider: React.FC<React.PropsWithChildren<{}>> = ({ children }) => {
const [cards, setCards] = useState<CardData[]>([]);

const addCard = (card: CardData) => {
setCards((prevCards) => [...prevCards, card]);
};

const removeCard = (cardId: number) => {
setCards((prevCards) => prevCards.filter((card) => card.id !== cardId));
};

const clearCart = ()=>{
setCards([]);
}

return (
<CartContext.Provider value={{ cards, addCard ,removeCard, clearCart}}>
{children}
</CartContext.Provider>
);
};
29 changes: 29 additions & 0 deletions Components/FavoriteButton/FavoriteButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { useState } from "react";
import { TouchableOpacity, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { Colors } from "../../styles/index";

type Props ={
size: number,
}
const FavoriteButton = ({size}:Props) => {
const [isFavorite, setIsFavorite] = useState(false);

const handlePress = () => {
setIsFavorite(!isFavorite);
};

return (
<TouchableOpacity onPress={handlePress}>
<View>
<Ionicons
name={isFavorite ? "heart" : "heart-outline"}
size={size}
color={isFavorite ? Colors.favoriteButton : Colors.favoriteButton}
/>
</View>
</TouchableOpacity>
);
};

export default FavoriteButton;
74 changes: 74 additions & 0 deletions Components/GridCard/GridCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { Text, View, FlatList, Image, TouchableOpacity } from "react-native";
import styles from "./Styles";
import React, { useState, useEffect } from "react";
import axios from "axios";
import FavoriteButton from "../FavoriteButton/FavoriteButton";
import { useNavigation } from "@react-navigation/native";
import { PriceCardHome } from "../PriceCardHome/PriceCardHome";

type IconData = {
id: number;
title: string;
price: number;
image: string;
description: string;
};

const GridCard = (): JSX.Element => {
const [cardsData, setCardsData] = useState<IconData[]>([]);
const navigation = useNavigation();

useEffect(() => {
fetchCardsData();
}, []);

const fetchCardsData = async () => {
try {
const response = await axios.get("https://fakestoreapi.com/products/");
setCardsData(response.data);
} catch (error) {
console.error("Error fetching data: ", error);
}
};

const handleCardPress = (item: IconData) => {
navigation.navigate("ProductScreen", {
id: item.id,
title: item.title,
price: item.price,
image: item.image,
description: item.description,
});
};
const renderCard = ({ item }: { item: IconData }) => (
<TouchableOpacity style={styles.cardContainer} onPress={() => handleCardPress(item)}>
<View style={styles.card}>
<Text style={styles.productTitle} numberOfLines={1}>
{item.title}
</Text>
<View style={styles.imageContainer}>
<Image source={{ uri: item.image }} style={styles.cardImage} resizeMode="contain" />
</View>
<View style={styles.priceAndFavoriteContainer}>
<View style={styles.priceContainer}>
<PriceCardHome priceText={"R$"} priceNumber={item.price} />
</View>
<View>
<FavoriteButton size={33} />
</View>
</View>
</View>
</TouchableOpacity>
);

return (
<FlatList
data={cardsData}
numColumns={2}
renderItem={renderCard}
keyExtractor={(item) => item.id.toString()}
/>
);
};

export default GridCard;
47 changes: 47 additions & 0 deletions Components/GridCard/Styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Colors } from "../../styles/index";
import { StyleSheet } from "react-native";

const styles = StyleSheet.create({
cardContainer: {
flex: 1,
backgroundColor: Colors.white,
height: 226,
width: 186,
margin: 5,
borderRadius: 10,
padding: 5,
justifyContent: 'center',
},
card :{
alignItems: 'center',
},
imageContainer: {
marginBottom: 10,
},
cardImage: {
alignSelf: "center",
width: 120,
height: 120,
top: 14,
marginBottom: 10,
},
productTitle: {
textAlign: 'left',
color: Colors.background,
fontSize: 12,
fontWeight: "700",
width: 145,
},

priceAndFavoriteContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
marginTop: 4,
},
priceContainer:{
marginRight: 10,
}
});

export default styles;
18 changes: 18 additions & 0 deletions Components/NotificationCard/NotificationCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { TouchableOpacity, View, Text } from "react-native";
import styles from "./Styles";

function NotificationCard({ children, onPress}: any) {
return(
<View style={styles.container}>
<View style={styles.textContainer}>
<Text style={styles.cardTitle}>Good!</Text>
<Text style={styles.cardText}>{children}</Text>
</View>
<TouchableOpacity onPress={onPress} style={styles.okContainer}>
<Text style={styles.okText}>OK</Text>
</TouchableOpacity>
</View>
);
}

export default NotificationCard;
Loading