Skip to content

Commit

Permalink
worked on styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jerkur22 committed Apr 2, 2023
1 parent 5b2da13 commit 79fdd26
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 21 deletions.
39 changes: 39 additions & 0 deletions contexts/LikePostsProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { useState, useContext, createContext } from 'react';


const LikedPostsContext = createContext();

const LikedPostsProvider = ({ children }) => {
const [likedPosts, setLikedPosts] = useState([]);

const addLikedPost = (post) => {
setLikedPosts([...likedPosts, post]);
};

const removeLikedPost = (post) => {
const updatedLikedPosts = likedPosts.filter((likedPost) => likedPost.id !== post.id);
setLikedPosts(updatedLikedPosts);
};

const value = {
likedPosts,
addLikedPost,
removeLikedPost,
};

return (
<LikedPostsContext.Provider value={value}>
{children}
</LikedPostsContext.Provider>
);
};

const useLikedPosts = () => {
const context = useContext(LikedPostsContext);
if (context === undefined) {
throw new Error('useLikedPosts must be used within a LikedPostsProvider');
}
return context;
};

export { LikedPostsProvider, useLikedPosts };
17 changes: 15 additions & 2 deletions screens/LoginScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Text,
TextInput,
TouchableOpacity,
View,
View, Image
} from "react-native";
import { db, auth } from "../firebase";
const docRef = db.collection("users");
Expand Down Expand Up @@ -57,6 +57,9 @@ const LoginScreen = () => {
};

return (

<>
<Image source={require('../assets/image.png')} style={{width:350, marginTop: 50, marginHorizontal: 20}} resizeMode="contain"/>
<KeyboardAvoidingView style={styles.container} behavior="padding">
<View style={styles.inputContainer}>
<TextInput
Expand Down Expand Up @@ -86,6 +89,16 @@ const LoginScreen = () => {
</TouchableOpacity>
</View>
</KeyboardAvoidingView>








</>

);
};

Expand All @@ -105,7 +118,7 @@ const styles = StyleSheet.create({
paddingHorizontal: 15,
paddingVertical: 10,
borderRadius: 10,
marginTop: 5,
marginTop: 15,
},
buttonContainer: {
width: "60%",
Expand Down
16 changes: 4 additions & 12 deletions screens/ResidenciesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ResidenciesList = ({ city }) => {

return (
<View padding={30} >
<Text style = {{color: "#2596be", fontSize:30, textAlign: "center"}}>Homestays in {city}</Text>
<Text style = {{color: "#2596be", fontSize:30, textAlign: "center", marginTop:20}}>Homestays in {city}</Text>
<FlatList
contentContainterStyle={styles.packagesListContainer}
data={residences}
Expand All @@ -75,19 +75,11 @@ const ResidenciesList = ({ city }) => {
<Text style={styles.cost}>
{"$" + item.cost + "/night"}
</Text>
{/* change styling */}
<Text style={styles.cost}>
{getDate(item.first_day)}{" "}
</Text>
<Text>to</Text>
<Text style={styles.cost}>
{getDate(item.second_day)}{" "}
</Text>
<Image
source={{ uri: item.images[0] }}
style={styles.image}
/>
<View style={{ marginTop: 40 }}></View>
<View style={{ marginTop: 80 }}></View>
</View>
</TouchableOpacity>
)}
Expand Down Expand Up @@ -118,8 +110,8 @@ const styles = StyleSheet.create({
marginBottom: 10,
},
image: {
width: "155%",
height: "155%",
width: "175%",
height: "160%",
borderRadius: 10,
marginHorizontal: 10,
marginVertical: 1,
Expand Down
15 changes: 8 additions & 7 deletions screens/SettingsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ const SettingsScreen = () => {
style={{
fontSize: 30,
marginTop: 55,
paddingHorizontal: 10,
paddingHorizontal: 140,
color: "#2596be",
}}
>
Settings
</Text>
<TouchableOpacity onPress={handleSignOut} style={styles.button}>
<Text style={styles.buttonText}>Sign out</Text>
</TouchableOpacity>
<View style={{marginLeft:99}}>
<TouchableOpacity onPress={handleSignOut} style={styles.button}>
<Text style={styles.buttonText}>Sign out</Text>
</TouchableOpacity>
</View>
</View>
);
};
Expand All @@ -39,11 +41,10 @@ const styles = StyleSheet.create({
button: {
backgroundColor: "#1E88E5",
paddingVertical: 10,
paddingHorizontal: 60,

paddingHorizontal: 5,
borderRadius: 12,
width: 200,
marginTop: 20,
marginTop: 290,
},
buttonText: {
color: "#FFF",
Expand Down

0 comments on commit 79fdd26

Please sign in to comment.