Fix: gradient background on signup page; Added: color for text in button, on index page added new button and greeting

This commit is contained in:
Matěj Kevin Nechodom 2024-05-09 20:06:20 +02:00
parent a25ce29154
commit e8a0449ad2
4 changed files with 41 additions and 7 deletions

View File

@ -2,7 +2,7 @@ import { StyleSheet, Text, View } from "react-native";
import Button from "@components/Button"; import Button from "@components/Button";
import { colors } from "@components/style"; import { colors } from "@components/style";
import { useAuth } from "@context/AuthContext"; import { useAuth } from "@context/AuthContext";
import Link from "@components/Link"; import { router } from "expo-router";
export default function Index() { export default function Index() {
const { onLogout, authState } = useAuth(); const { onLogout, authState } = useAuth();
@ -10,8 +10,19 @@ export default function Index() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.h1}>Welcome {user.username}</Text> <Text style={styles.h1}>Welcome {user.username}!</Text>
<Link href="/beer">Go to BEER</Link> <Text style={styles.h2}>We hope, you're enjoying your beer.</Text>
<View style={styles.button}>
<Button
style={styles.button}
title="Add beer!"
color={colors.gold}
textColor={colors.white}
onPress={() => {
router.push("/beer");
}}
></Button>
</View>
</View> </View>
); );
} }
@ -27,4 +38,16 @@ const styles = StyleSheet.create({
textAlign: "center", textAlign: "center",
paddingTop: "20%", paddingTop: "20%",
}, },
h2: {
color: "#FFF",
fontSize: 20,
textAlign: "center",
paddingTop: "1%",
},
button: {
color: colors.charcoal,
fontSize: 30,
textAlign: "center",
paddingTop: "2%",
},
}); });

View File

@ -83,7 +83,6 @@ const styles = StyleSheet.create({
container: { container: {
width: "100%", width: "100%",
height: "100%", height: "100%",
backgroundColor: colors.dark,
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
}, },

View File

@ -155,6 +155,13 @@ const styles = StyleSheet.create({
fontSize: 14, fontSize: 14,
marginTop: 10, marginTop: 10,
}, },
gradient: {
position: "absolute",
left: 0,
right: 0,
top: 0,
height: "100%",
},
}); });
export default SignupPage; export default SignupPage;

View File

@ -2,7 +2,12 @@ import React from "react";
import { Text, StyleSheet, Pressable } from "react-native"; import { Text, StyleSheet, Pressable } from "react-native";
export default function Button(props) { export default function Button(props) {
const { onPress, title = "Button", color = "black" } = props; const {
onPress,
title = "Button",
color = "black",
textColor = "white",
} = props;
return ( return (
<Pressable <Pressable
style={({ pressed }) => [ style={({ pressed }) => [
@ -17,7 +22,7 @@ export default function Button(props) {
]} ]}
onPress={onPress} onPress={onPress}
> >
<Text style={styles.text}>{title}</Text> <Text style={[styles.text, { color: textColor }]}>{title}</Text>
</Pressable> </Pressable>
); );
} }
@ -36,6 +41,6 @@ const styles = StyleSheet.create({
lineHeight: 21, lineHeight: 21,
fontWeight: "bold", fontWeight: "bold",
letterSpacing: 0.25, letterSpacing: 0.25,
color: "white", //color: textColor,
}, },
}); });