Skip to content

Commit

Permalink
Revamp home header
Browse files Browse the repository at this point in the history
  • Loading branch information
TenType committed Jul 13, 2024
1 parent 0e0c1d2 commit 3340aa4
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
7 changes: 5 additions & 2 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import "@expo/metro-runtime";
import { StyleSheet } from "react-native";
import { StatusBar } from "expo-status-bar";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

import colors from "./src/constants/colors";
import HomeScreen from "./src/screens/HomeScreen";
import AccountScreen from "./src/screens/AccountScreen";
// import SignInScreen from "./src/screens/SignInScreen";
import DonateScreen from "./src/screens/DonateScreen";
import WebsitesScreen from "./src/screens/WebsitesScreen";
import VolunteerFormScreen from "./src/screens/VolunteerFormScreen";
import VolunteerOpportunityScreen from "./src/screens/VolunteerOpportunityScreen";
import OtherInfoScreen from "./src/screens/OtherInfoScreen";
import HomeHeader from "./src/components/HomeHeader";

const Stack = createNativeStackNavigator();

Expand All @@ -31,9 +34,10 @@ export default function App() {
name="Home"
component={HomeScreen}
options={{
title: "Audacity Music Club",
header: (props) => <HomeHeader {...props} />,
}}
/>
<Stack.Screen name="Account" component={AccountScreen} />
<Stack.Screen name="Donate" component={DonateScreen} />
<Stack.Screen name="Websites" component={WebsitesScreen} />
<Stack.Screen name="Other Info" component={OtherInfoScreen} />
Expand All @@ -45,7 +49,6 @@ export default function App() {
headerStyle: {
backgroundColor: colors.black,
},
headerBackTitle: "Home",
}}
/>
<Stack.Screen name="Volunteer Form" component={VolunteerFormScreen} />
Expand Down
Binary file added src/assets/placeholder-profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions src/components/HomeHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Image, Text, StyleSheet, Pressable, View } from "react-native";
import { LinearGradient } from "expo-linear-gradient";
import colors from "../constants/colors";

export default function HomeHeader({ navigation }) {
return (
<LinearGradient
colors={[colors.primaryLight, colors.primaryDark]}
style={styles.container}
>
<View style={styles.subcontainer}>
<Text style={styles.headerText}>Audacity Music Club</Text>
<Pressable onPress={() => navigation.navigate("Account")}>
<Image
style={styles.profile}
source={require("../assets/placeholder-profile.png")}
/>
</Pressable>
</View>
</LinearGradient>
);
}

const styles = StyleSheet.create({
container: {
height: 120,
paddingHorizontal: 20,
paddingBottom: 10,
justifyContent: "flex-end",
},
subcontainer: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
},
headerText: {
color: colors.white,
fontSize: 20,
},
profile: {
width: 40,
height: 40,
borderRadius: 100,
},
});
9 changes: 5 additions & 4 deletions src/components/Logout.js → src/components/LogOutButton.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { StyleSheet, Text, Pressable } from "react-native";
import { StyleSheet, Text, Pressable, Alert } from "react-native";
import colors from "../constants/colors";

export default function Logout() {
export default function LogOutButton() {
return (
<Pressable style={styles.button}>
<Pressable style={styles.button} onPress={() => Alert.alert("Log out")}>
<Text style={styles.text}> Log Out</Text>
</Pressable>
);
}

const styles = StyleSheet.create({
button: {
backgroundColor: "#d9534f",
backgroundColor: colors.danger,
borderRadius: 10,
paddingVertical: 10,
paddingHorizontal: 110,
Expand Down
14 changes: 7 additions & 7 deletions src/components/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export default function Profile() {
<View style={styles.background}>
<Image
style={styles.image}
source={require("./../assets/audacity-music-club.png")}
source={require("./../assets/placeholder-profile.png")}
></Image>
<View>
<Text style={styles.name}>Rick</Text>
<Text style={styles.email}>cat</Text>
<Text style={styles.name}>Rick Astley</Text>
<Text style={styles.email}>nevergonnagiveyouup@gmail.com</Text>
</View>
</View>
);
Expand All @@ -20,16 +20,16 @@ const styles = StyleSheet.create({
flexDirection: "row",
alignItems: "center",
backgroundColor: "#f5f5f5", // Light grey background color
padding: 20,
padding: 15,
borderRadius: 10,
borderColor: "#e0e0e0",
borderWidth: 1,
margin: 10,
},
image: {
width: 50,
height: 50,
borderRadius: 25,
width: 60,
height: 60,
borderRadius: 100,
marginRight: 10,
},
name: {
Expand Down
5 changes: 4 additions & 1 deletion src/constants/colors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export default {
primary: "#007913",
primary: "#006000",
primaryLight: "#008000",
primaryDark: "#004000",
secondary: "#353535",
danger: "#E12504",
black: "#000",
white: "#fff",
};
11 changes: 6 additions & 5 deletions src/screens/AccountScreen.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { StyleSheet, Text, View } from "react-native";
import LogOutButton from "../components/Logout.js";
import { View } from "react-native";

import LogOutButton from "../components/LogOutButton.js";
import Profile from "../components/Profile.js";

export default function AccountScreen() {
return (
<View>
<Text>{"\n\n\n\n\n\n\n"}</Text>
<Profile></Profile>
<LogOutButton></LogOutButton>
<Profile />
<LogOutButton />
</View>
);
}

0 comments on commit 3340aa4

Please sign in to comment.