Skip to content

Commit 7e6adee

Browse files
authored
Merge branch 'main' into main
2 parents a2764d6 + 3618154 commit 7e6adee

12 files changed

+897
-589
lines changed

client/assets/apple_logo.png

14.5 KB
Loading

client/assets/facebook_logo.png

53.5 KB
Loading
76.8 KB
Binary file not shown.
77.1 KB
Binary file not shown.

client/assets/github_logo.png

6.24 KB
Loading

client/assets/google_logo.png

16.2 KB
Loading

client/src/components/Auth/LoginScreen.tsx

+177-38
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,38 @@ import {
99
Platform,
1010
TouchableWithoutFeedback,
1111
Keyboard,
12+
TouchableOpacity,
1213
} from "react-native";
1314
import { LogInEmailInput, LogInPasswordInput } from "../Common/CustomInputs";
14-
import { LogInButton } from "../Common/AuthButtons";
15+
import { LogInButton, ExternalLoginButton } from "../Common/AuthButtons";
1516
import { useLocalSearchParams, useRouter } from "expo-router";
1617
import { appSignIn } from "../../services/store";
17-
import { AuthenticationErrorMessage, AuthenticationResponse } from "./AuthenticationResponse";
18+
import {
19+
AuthenticationErrorMessage,
20+
AuthenticationResponse,
21+
} from "./AuthenticationResponse";
22+
import { ArrowLeftCircle } from "react-native-feather";
1823

1924
const LoginScreen = () => {
2025
const router = useRouter();
2126
const [fontsLoaded, fontError] = useFonts({
22-
"Gilroy-ExtraBold": require("../../../assets/fonts/Gilroy-ExtraBold.otf"),
23-
"Gilroy-Light": require("../../../assets/fonts/Gilroy-Light.otf"),
27+
"Quicksand-Bold": require("../../../assets/fonts/Quicksand-Bold.ttf"),
28+
"Quicksand-Medium": require("../../../assets/fonts/Quicksand-Medium.ttf"),
2429
});
2530

2631
const { inputEmail } = useLocalSearchParams();
2732
const [email, setEmail] = React.useState<string>("");
2833
const [password, setPassword] = React.useState<string>("");
29-
const [authResponse, setAuthResponse] = React.useState<AuthenticationResponse>();
34+
const [authResponse, setAuthResponse] =
35+
React.useState<AuthenticationResponse>();
3036
const [invalidLogin, invalidateLogin] = React.useState<boolean>(false); // Possbily change this?
3137

38+
const externalLoginIcons = {
39+
google: require("../../../assets/google_logo.png"),
40+
facebook: require("../../../assets/facebook_logo.png"),
41+
apple: require("../../../assets/apple_logo.png"),
42+
};
43+
3244
// Sign in function with email and password
3345
const onHandleSubmit = async () => {
3446
Keyboard.dismiss();
@@ -43,7 +55,7 @@ const LoginScreen = () => {
4355
console.log(authResponse.error);
4456
invalidateLogin(true);
4557
}
46-
}, [authResponse])
58+
}, [authResponse]);
4759

4860
useEffect(() => {
4961
setEmail(inputEmail?.toString() || ""); // On load of the page, set the email to the inputEmail if they entered it!
@@ -53,41 +65,117 @@ const LoginScreen = () => {
5365
return null;
5466
}
5567

68+
const handleGoogleSignIn = async () => {
69+
console.log("Google Sign In");
70+
};
71+
72+
const handleFacebookSignIn = async () => {
73+
console.log("Facebook Sign In");
74+
};
75+
76+
const handleAppleSignIn = async () => {
77+
console.log("Apple Sign In");
78+
};
79+
80+
const handleGithubSignIn = async () => {
81+
console.log("Github Sign In");
82+
};
83+
5684
return (
5785
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
5886
<View>
59-
<KeyboardAvoidingView
60-
behavior={Platform.OS === "ios" ? "padding" : undefined}
61-
>
62-
<View style={styles.main_container}>
63-
<View style={styles.header_container}>
64-
<Text style={styles.header_text}>Welcome back!</Text>
65-
</View>
66-
<View style={styles.input_container}>
67-
<LogInEmailInput
68-
value={email}
69-
onChangeText={(text) => setEmail(text)}
70-
invalid={invalidLogin}
71-
/>
72-
<LogInPasswordInput
73-
value={password}
74-
onChangeText={(text) => setPassword(text)}
75-
invalid={invalidLogin}
76-
/>
77-
</View>
78-
<View style={styles.button_container}>
79-
<LogInButton onPress={onHandleSubmit} />
87+
<View style={styles.main_container}>
88+
<TouchableOpacity
89+
onPress={() => router.back()}
90+
style={styles.back_button}
91+
>
92+
<ArrowLeftCircle
93+
color={"black"}
94+
strokeWidth={1.4}
95+
width={34}
96+
height={34}
97+
/>
98+
</TouchableOpacity>
99+
<View style={styles.header_container}>
100+
<Text style={styles.header_text}>Welcome back!</Text>
101+
<Text style={styles.subheader_text}>How have you been?</Text>
102+
</View>
103+
<View style={styles.input_container}>
104+
<LogInEmailInput
105+
value={email}
106+
onChangeText={(text) => setEmail(text)}
107+
invalid={invalidLogin}
108+
/>
109+
<LogInPasswordInput
110+
value={password}
111+
onChangeText={(text) => setPassword(text)}
112+
invalid={invalidLogin}
113+
/>
114+
</View>
115+
<View style={styles.button_container}>
116+
<LogInButton onPress={onHandleSubmit} />
117+
</View>
118+
<TouchableOpacity>
119+
<Text
120+
style={[styles.regular_text, { textDecorationLine: "underline" }]}
121+
>
122+
Forgot password?
123+
</Text>
124+
</TouchableOpacity>
125+
<View style={styles.divider_container}>
126+
<View style={styles.horizontal_line} />
127+
<View>
128+
<Text style={[styles.regular_text, { marginHorizontal: 10 }]}>
129+
Or Login With
130+
</Text>
80131
</View>
132+
<View style={styles.horizontal_line} />
81133
</View>
82-
</KeyboardAvoidingView>
83134

84-
<View style={styles.error_container}>
85-
<AuthenticationErrorMessage response={authResponse} onPress={() => {
86-
setAuthResponse(undefined)
87-
invalidateLogin(false)
88-
}} />
135+
<View style={styles.externalLinkContainer}>
136+
<ExternalLoginButton
137+
onPress={handleGoogleSignIn}
138+
companyName="google"
139+
/>
140+
<ExternalLoginButton
141+
onPress={handleAppleSignIn}
142+
companyName="apple"
143+
/>
144+
<ExternalLoginButton
145+
onPress={handleFacebookSignIn}
146+
companyName="facebook"
147+
/>
148+
<ExternalLoginButton
149+
onPress={handleGithubSignIn}
150+
companyName="github"
151+
/>
152+
</View>
153+
<View style={styles.footer_text_container}>
154+
<Text style={styles.footer_text}>Don't have an account?</Text>
155+
<TouchableOpacity
156+
onPress={() => router.replace({ pathname: "/signup" })}
157+
>
158+
<Text
159+
style={[
160+
styles.footer_text,
161+
{ color: "#5dbea3", textDecorationLine: "underline" },
162+
]}
163+
>
164+
Sign up
165+
</Text>
166+
</TouchableOpacity>
167+
</View>
89168
</View>
90169

170+
<View style={styles.error_container}>
171+
<AuthenticationErrorMessage
172+
response={authResponse}
173+
onPress={() => {
174+
setAuthResponse(undefined);
175+
invalidateLogin(false);
176+
}}
177+
/>
178+
</View>
91179
</View>
92180
</TouchableWithoutFeedback>
93181

@@ -102,8 +190,12 @@ const styles = StyleSheet.create({
102190
display: "flex",
103191
height: "100%",
104192
width: "100%",
105-
justifyContent: "center",
193+
justifyContent: "flex-start",
106194
alignItems: "center",
195+
paddingHorizontal: Dimensions.get("window").width * 0.11,
196+
paddingVertical: Dimensions.get("window").height * 0.01,
197+
backgroundColor: "white",
198+
gap: Dimensions.get("window").height * 0.029,
107199
},
108200

109201
//This is an example of where the error message could be
@@ -112,7 +204,7 @@ const styles = StyleSheet.create({
112204
justifyContent: "space-around",
113205
alignItems: "center",
114206
width: "100%",
115-
bottom: Dimensions.get("window").height * 0.10,
207+
top: Dimensions.get("window").height * 0.1,
116208
position: "absolute",
117209
},
118210

@@ -134,13 +226,60 @@ const styles = StyleSheet.create({
134226
header_container: {
135227
display: "flex",
136228
justifyContent: "center",
137-
alignItems: "center",
229+
alignItems: "flex-start",
138230
width: "100%",
231+
marginBottom: Dimensions.get("window").height * 0.019,
232+
marginTop: Dimensions.get("window").height * 0.23,
139233
},
140234

141235
header_text: {
142-
fontFamily: "Gilroy-ExtraBold",
143-
fontSize: 30,
236+
fontFamily: "Quicksand-Bold",
237+
fontSize: 37,
238+
marginBottom: Dimensions.get("window").height * 0.01,
239+
},
240+
subheader_text: {
241+
fontFamily: "Quicksand-Medium",
242+
fontSize: 20,
243+
},
244+
regular_text: {
245+
fontFamily: "Quicksand-Medium",
246+
color: "#8E8E8E",
247+
},
248+
horizontal_line: {
249+
flex: 1,
250+
height: 1,
251+
backgroundColor: "#8E8E8E",
252+
},
253+
externalLinkContainer: {
254+
display: "flex",
255+
flexDirection: "row",
256+
justifyContent: "space-between",
257+
alignItems: "center",
258+
width: "100%",
259+
},
260+
footer_text: {
261+
fontFamily: "Quicksand-Bold",
262+
color: "black",
263+
fontSize: 15,
264+
},
265+
footer_text_container: {
266+
display: "flex",
267+
flexDirection: "row",
268+
justifyContent: "center",
269+
alignItems: "flex-end",
270+
gap: 7,
271+
flex: 1,
272+
paddingBottom: Dimensions.get("window").height * 0.01,
273+
},
274+
divider_container: {
275+
flexDirection: "row",
276+
alignItems: "center",
277+
marginVertical: Dimensions.get("window").height * 0.011,
278+
},
279+
back_button: {
280+
position: "absolute",
281+
top: Dimensions.get("window").height * 0.075,
282+
left: Dimensions.get("window").width * 0.075,
144283
},
145284
});
146285

0 commit comments

Comments
 (0)