mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Unified styling for buttons
This commit is contained in:
parent
8fb8d6b8b2
commit
334978d2fd
7 changed files with 8 additions and 24 deletions
|
@ -1,21 +1,16 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Pressable, GestureResponderEvent } from "react-native";
|
import { Pressable } from "react-native";
|
||||||
import styles from "../../styles";
|
import styles from "../../styles";
|
||||||
|
import { colors } from "../../styles";
|
||||||
|
|
||||||
export interface props {
|
export default function DrawerButton({ color = colors.secondary_3, ...props }) {
|
||||||
children: React.ReactNode;
|
|
||||||
onPress: (event: GestureResponderEvent) => void;
|
|
||||||
color: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function DrawerButton(props: props) {
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
style={{
|
style={{
|
||||||
...styles.button_template,
|
...styles.button_template,
|
||||||
...{
|
...{
|
||||||
backgroundColor: props.color,
|
backgroundColor: color,
|
||||||
width: "95%",
|
width: "95%",
|
||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,7 +36,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_3}
|
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
dispatch(logout());
|
dispatch(logout());
|
||||||
await AsyncStorage.clear();
|
await AsyncStorage.clear();
|
||||||
|
@ -61,7 +60,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>Stud-E</Text>
|
<Text style={styles.text_white_medium}>Stud-E</Text>
|
||||||
</View>
|
</View>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_2}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("Home");
|
navigation.navigate("Home");
|
||||||
}}
|
}}
|
||||||
|
@ -70,7 +68,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>Home</Text>
|
<Text style={styles.text_white_medium}>Home</Text>
|
||||||
</DrawerButton>
|
</DrawerButton>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_2}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("User Info");
|
navigation.navigate("User Info");
|
||||||
}}
|
}}
|
||||||
|
@ -79,7 +76,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>User Info</Text>
|
<Text style={styles.text_white_medium}>User Info</Text>
|
||||||
</DrawerButton>
|
</DrawerButton>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_2}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("Subjects");
|
navigation.navigate("Subjects");
|
||||||
}}
|
}}
|
||||||
|
@ -88,7 +84,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>Subjects</Text>
|
<Text style={styles.text_white_medium}>Subjects</Text>
|
||||||
</DrawerButton>
|
</DrawerButton>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_3}
|
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
dispatch(logout());
|
dispatch(logout());
|
||||||
await AsyncStorage.clear();
|
await AsyncStorage.clear();
|
||||||
|
@ -113,7 +108,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>Stud-E</Text>
|
<Text style={styles.text_white_medium}>Stud-E</Text>
|
||||||
</View>
|
</View>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_2}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("Login");
|
navigation.navigate("Login");
|
||||||
}}
|
}}
|
||||||
|
@ -122,7 +116,6 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
<Text style={styles.text_white_medium}>Login</Text>
|
<Text style={styles.text_white_medium}>Login</Text>
|
||||||
</DrawerButton>
|
</DrawerButton>
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color={colors.secondary_2}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("Register");
|
navigation.navigate("Register");
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -43,6 +43,9 @@ export default function Home() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
requestLocation();
|
requestLocation();
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
useEffect(() => {
|
||||||
|
requestLocation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
async function getDistance(location: LocationType) {
|
async function getDistance(location: LocationType) {
|
||||||
let dist = GetDistance(
|
let dist = GetDistance(
|
||||||
|
|
|
@ -99,14 +99,10 @@ export default function Login() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
color={colors.secondary_3}
|
|
||||||
>
|
>
|
||||||
<Text style={styles.text_white_small}>Login</Text>
|
<Text style={styles.text_white_small}>Login</Text>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button onPress={() => navigation.navigate("Register")}>
|
||||||
onPress={() => navigation.navigate("Register")}
|
|
||||||
color={colors.secondary_3}
|
|
||||||
>
|
|
||||||
<Text style={styles.text_white_small}>Register</Text>
|
<Text style={styles.text_white_small}>Register</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</AnimatedContainer>
|
</AnimatedContainer>
|
||||||
|
|
|
@ -158,7 +158,6 @@ export default function Register() {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
color={colors.secondary_3}
|
|
||||||
>
|
>
|
||||||
<Text style={styles.text_white_small}>Register</Text>
|
<Text style={styles.text_white_small}>Register</Text>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -201,7 +201,6 @@ export default function SubjectsPage() {
|
||||||
</View>
|
</View>
|
||||||
<View style={{ zIndex: -1 }}>
|
<View style={{ zIndex: -1 }}>
|
||||||
<Button
|
<Button
|
||||||
color={colors.secondary_3}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (subjectsOpen) {
|
if (subjectsOpen) {
|
||||||
setSelectedSubjects([]);
|
setSelectedSubjects([]);
|
||||||
|
|
|
@ -311,7 +311,6 @@ export default function UserInfoPage() {
|
||||||
<View style={styles.padding} />
|
<View style={styles.padding} />
|
||||||
<View style={{ zIndex: -1 }}>
|
<View style={{ zIndex: -1 }}>
|
||||||
<Button
|
<Button
|
||||||
color={colors.secondary_3}
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (isEditable) {
|
if (isEditable) {
|
||||||
setYearLevelOpen(false);
|
setYearLevelOpen(false);
|
||||||
|
|
Loading…
Reference in a new issue