Skip to content

Commit d6541c7

Browse files
Copilotthedev132
andcommitted
Redesign login page UI with new layout and functionality
Co-authored-by: thedev132 <[email protected]>
1 parent 51ff2f1 commit d6541c7

File tree

1 file changed

+144
-46
lines changed

1 file changed

+144
-46
lines changed

src/pages/login.tsx

Lines changed: 144 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
import Icon from "@thedev132/hackclub-icons-rn";
13
import {
24
useAuthRequest,
35
makeRedirectUri,
@@ -6,13 +8,17 @@ import {
68
} from "expo-auth-session";
79
import * as Haptics from "expo-haptics";
810
import * as SystemUI from "expo-system-ui";
11+
import * as WebBrowser from "expo-web-browser";
912
import { useContext, useEffect, useRef, useState } from "react";
1013
import {
1114
Text,
1215
View,
1316
Animated,
1417
SafeAreaView,
1518
useColorScheme,
19+
ImageBackground,
20+
StyleSheet,
21+
Pressable,
1622
} from "react-native";
1723

1824
import AuthContext from "../auth/auth";
@@ -130,54 +136,146 @@ export default function Login() {
130136
}).start();
131137
}, [animation]);
132138

139+
const handleWhatsHCB = async () => {
140+
await WebBrowser.openBrowserAsync(
141+
"https://hackclub.com/fiscal-sponsorship/",
142+
);
143+
};
144+
145+
const handleSignUp = async () => {
146+
await WebBrowser.openBrowserAsync(
147+
"https://hcb.hackclub.com/users/auth?signup=true",
148+
);
149+
};
150+
151+
const styles = StyleSheet.create({
152+
container: {
153+
flex: 1,
154+
backgroundColor: theme.colors.background,
155+
},
156+
backgroundImage: {
157+
flex: 1,
158+
},
159+
overlay: {
160+
flex: 1,
161+
backgroundColor: isDark ? "rgba(0, 0, 0, 0.6)" : "rgba(0, 0, 0, 0.3)",
162+
},
163+
content: {
164+
flex: 1,
165+
justifyContent: "flex-end",
166+
paddingHorizontal: 20,
167+
paddingBottom: 50,
168+
},
169+
iconContainer: {
170+
width: 80,
171+
height: 80,
172+
backgroundColor: palette.primary,
173+
borderRadius: 20,
174+
alignItems: "center",
175+
justifyContent: "center",
176+
marginBottom: 24,
177+
shadowColor: "#000",
178+
shadowOffset: { width: 0, height: 4 },
179+
shadowOpacity: 0.3,
180+
shadowRadius: 8,
181+
elevation: 8,
182+
},
183+
icon: {
184+
width: 48,
185+
height: 48,
186+
},
187+
welcomeText: {
188+
fontSize: 32,
189+
fontWeight: "bold",
190+
color: "#FFFFFF",
191+
marginBottom: 12,
192+
},
193+
highlightText: {
194+
color: palette.primary,
195+
},
196+
descriptionText: {
197+
fontSize: 16,
198+
color: "#FFFFFF",
199+
opacity: 0.9,
200+
marginBottom: 20,
201+
lineHeight: 22,
202+
},
203+
whatsHCBContainer: {
204+
marginBottom: 24,
205+
},
206+
whatsHCBText: {
207+
fontSize: 16,
208+
fontWeight: "600",
209+
color: "#FFFFFF",
210+
},
211+
buttonContainer: {
212+
gap: 12,
213+
},
214+
});
215+
133216
return (
134-
<SafeAreaView
135-
style={{
136-
backgroundColor: theme.colors.background,
137-
flex: 1,
138-
flexDirection: "column",
139-
}}
140-
>
141-
<View
142-
style={{ flexGrow: 1, alignItems: "center", justifyContent: "center" }}
217+
<SafeAreaView style={styles.container}>
218+
<ImageBackground
219+
source={
220+
isDark
221+
? require("../../assets/banner-dark.png")
222+
: require("../../assets/banner-light.png")
223+
}
224+
style={styles.backgroundImage}
225+
resizeMode="cover"
143226
>
144-
<Animated.Image
145-
source={
146-
isDark
147-
? require("../../assets/icon.png")
148-
: require("../../assets/icon-light.png")
149-
}
150-
style={{
151-
width: 100,
152-
height: 100,
153-
marginBottom: 20,
154-
opacity: animation,
155-
transform: [
156-
{
157-
scale: animation.interpolate({
158-
inputRange: [0, 1],
159-
outputRange: [0.8, 1],
160-
}),
161-
},
162-
],
163-
}}
164-
/>
165-
<Text
166-
style={{ color: palette.muted, textAlign: "center", fontSize: 20 }}
167-
>
168-
Welcome to <Text style={{ color: palette.primary }}>HCB</Text>.
169-
</Text>
170-
</View>
171-
172-
<View style={{ marginBottom: 30 }}>
173-
<Button
174-
onPress={() => promptAsync()}
175-
loading={loading}
176-
style={{ marginHorizontal: 20 }}
177-
>
178-
Log in
179-
</Button>
180-
</View>
227+
<View style={styles.overlay}>
228+
<View style={styles.content}>
229+
<Animated.View
230+
style={{
231+
opacity: animation,
232+
transform: [
233+
{
234+
translateY: animation.interpolate({
235+
inputRange: [0, 1],
236+
outputRange: [20, 0],
237+
}),
238+
},
239+
],
240+
}}
241+
>
242+
<View style={styles.iconContainer}>
243+
<Icon glyph="bank-account" size={48} color="#FFFFFF" />
244+
</View>
245+
246+
<Text style={styles.welcomeText}>
247+
Welcome to <Text style={styles.highlightText}>HCB</Text>.
248+
</Text>
249+
250+
<Text style={styles.descriptionText}>
251+
Over 5,000 nonprofit projects use HCB to raise money and manage
252+
their finances.
253+
</Text>
254+
255+
<Pressable
256+
style={styles.whatsHCBContainer}
257+
onPress={handleWhatsHCB}
258+
>
259+
<Text style={styles.whatsHCBText}>What's HCB? →</Text>
260+
</Pressable>
261+
262+
<View style={styles.buttonContainer}>
263+
<Button
264+
onPress={() => promptAsync()}
265+
loading={loading}
266+
variant="outline"
267+
>
268+
Log in
269+
</Button>
270+
271+
<Button onPress={handleSignUp} variant="primary">
272+
Sign up
273+
</Button>
274+
</View>
275+
</Animated.View>
276+
</View>
277+
</View>
278+
</ImageBackground>
181279
</SafeAreaView>
182280
);
183281
}

0 commit comments

Comments
 (0)