Unified styling for buttons

This commit is contained in:
Keannu Christian Bernasol 2023-07-19 17:47:12 +08:00
parent 8fb8d6b8b2
commit 334978d2fd
7 changed files with 8 additions and 24 deletions

View file

@ -1,21 +1,16 @@
import * as React from "react";
import { Pressable, GestureResponderEvent } from "react-native";
import { Pressable } from "react-native";
import styles from "../../styles";
import { colors } from "../../styles";
export interface props {
children: React.ReactNode;
onPress: (event: GestureResponderEvent) => void;
color: string;
}
export default function DrawerButton(props: props) {
export default function DrawerButton({ color = colors.secondary_3, ...props }) {
return (
<Pressable
onPress={props.onPress}
style={{
...styles.button_template,
...{
backgroundColor: props.color,
backgroundColor: color,
width: "95%",
justifyContent: "flex-start",
},

View file

@ -36,7 +36,6 @@ export default function CustomDrawerContent(props: {}) {
</View>
<DrawerButton
color={colors.secondary_3}
onPress={async () => {
dispatch(logout());
await AsyncStorage.clear();
@ -61,7 +60,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>Stud-E</Text>
</View>
<DrawerButton
color={colors.secondary_2}
onPress={() => {
navigation.navigate("Home");
}}
@ -70,7 +68,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>Home</Text>
</DrawerButton>
<DrawerButton
color={colors.secondary_2}
onPress={() => {
navigation.navigate("User Info");
}}
@ -79,7 +76,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>User Info</Text>
</DrawerButton>
<DrawerButton
color={colors.secondary_2}
onPress={() => {
navigation.navigate("Subjects");
}}
@ -88,7 +84,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>Subjects</Text>
</DrawerButton>
<DrawerButton
color={colors.secondary_3}
onPress={async () => {
dispatch(logout());
await AsyncStorage.clear();
@ -113,7 +108,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>Stud-E</Text>
</View>
<DrawerButton
color={colors.secondary_2}
onPress={() => {
navigation.navigate("Login");
}}
@ -122,7 +116,6 @@ export default function CustomDrawerContent(props: {}) {
<Text style={styles.text_white_medium}>Login</Text>
</DrawerButton>
<DrawerButton
color={colors.secondary_2}
onPress={() => {
navigation.navigate("Register");
}}