Skip to content

Commit

Permalink
Add globalstyles for container to keep app background colour consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadfadhli committed Oct 21, 2024
1 parent b157bcf commit 2c9e733
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 49 deletions.
7 changes: 3 additions & 4 deletions frontend/iQMA-Skills-Builder/app/Courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as sectionEndpoints from '@/helpers/sectionEndpoints';
import {Colors} from '@/constants/Colors';
import { formatSection } from '@/helpers/formatSectionID';
import SectionProfile from '@/components/SectionProfile';
import { globalStyles } from '@/constants/styles';

export default function Courses() {
const {currentUser} = useContext(AuthContext);
Expand Down Expand Up @@ -63,9 +64,8 @@ export default function Courses() {
}

return (
<ScrollView style={styles.container}>
<View>
<>
<ScrollView style={globalStyles.container}>
<View style={styles.container}>
<View style={styles.sectionContainer}>
{courses.length > 0 ? (
courses
Expand All @@ -91,7 +91,6 @@ export default function Courses() {
<Text>No courses available</Text>
)}
</View>
</>
</View>
</ScrollView>
);
Expand Down
8 changes: 2 additions & 6 deletions frontend/iQMA-Skills-Builder/app/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {AuthContext} from '@/context/AuthContext';
import * as accountEndpoints from '@/helpers/accountEndpoints';
import {LoadingIndicator} from '@/components/LoadingIndicator';
import { router } from 'expo-router';
// import { ScrollView } from 'react-native-gesture-handler';
import { globalStyles } from '@/constants/styles';

export default function EditProfile() {
const {currentUser, isLoading} = useContext(AuthContext);
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function EditProfile() {

return (
<ScrollView
style={styles.container}
style={globalStyles.container}
>
<View style={styles.form}>
<Text style={styles.label}>FIRST NAME</Text>
Expand All @@ -83,10 +83,6 @@ export default function EditProfile() {
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#FFF',
},
form: {
padding: 20,
},
Expand Down
11 changes: 6 additions & 5 deletions frontend/iQMA-Skills-Builder/app/screens/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import SectionCard from '@/components/SectionCard';
import TopStats from '@/components/TopStats';
import {router} from 'expo-router';
import {useContext} from 'react';
import { globalStyles } from '@/constants/styles';


const HomeScreen: React.FC = () => {
Expand Down Expand Up @@ -417,7 +418,7 @@ const HomeScreen: React.FC = () => {
}

return (
<SafeAreaView style={styles.outerContainer}>
<SafeAreaView style={globalStyles.container}>
<ScrollView
contentContainerStyle={styles.container}
onScroll={onScroll}
Expand Down Expand Up @@ -457,12 +458,12 @@ const HomeScreen: React.FC = () => {
};

const styles = StyleSheet.create({
outerContainer: {
flex: 1,
},
// outerContainer: {
// flex: 1,
// },
container: {
padding: 20,
backgroundColor: '#F5F5F5',
// backgroundColor: '#F5F5F5',
},
lineSeparator: {
height: 1,
Expand Down
3 changes: 2 additions & 1 deletion frontend/iQMA-Skills-Builder/app/screens/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {router, useFocusEffect} from 'expo-router';
import {useContext} from 'react';
import {Achievements} from '@/components/Achievement';
import CertificationsList from '@/components/Certification';
import { globalStyles } from '@/constants/styles';

const ProfilePage: React.FC = () => {
const {currentUser, isLoading} = useContext(AuthContext);
Expand Down Expand Up @@ -95,7 +96,7 @@ const ProfilePage: React.FC = () => {

return (
<ScrollView contentContainerStyle={styles.scrollView}>
<View style={styles.container}>
<View style={globalStyles.container}>
<ProfileCard userDetails={userDetails} />

<Achievements achievements={badges} />
Expand Down
67 changes: 35 additions & 32 deletions frontend/iQMA-Skills-Builder/app/screens/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { StyleSheet, Text, View ,Button,Alert} from 'react-native';
import React, { useContext, useEffect, useState } from 'react';
import {StyleSheet, Text, View, Button, Alert, ScrollView} from 'react-native';
import React, {useContext, useEffect, useState} from 'react';
import CustomSwitch from '@/components/CustomSwitch';
import { CustomButton } from '@/components/CustomButton';
import { AuthContext } from '@/context/AuthContext';
import {CustomButton} from '@/components/CustomButton';
import {AuthContext} from '@/context/AuthContext';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { LoadingIndicator } from '@/components/LoadingIndicator';
import { router } from 'expo-router';
import { Colors } from '@/constants/Colors';
import {LoadingIndicator} from '@/components/LoadingIndicator';
import {router} from 'expo-router';
import {Colors} from '@/constants/Colors';
import {globalStyles} from '@/constants/styles';

export default function Settings() {
const {logOut} = useContext(AuthContext);
Expand Down Expand Up @@ -68,35 +69,37 @@ export default function Settings() {
}

return (
<View style={styles.container}>
<Text style={styles.textHeading}>GENERAL</Text>
<View style={styles.switchContainer}>
<Text style={styles.label}>Sound Effects</Text>
<CustomSwitch
isEnabled={isSoundEffectsEnabled}
onToggle={toggleSoundEffects}
<ScrollView style={globalStyles.container}>
<View style={styles.container}>
<Text style={styles.textHeading}>GENERAL</Text>
<View style={styles.switchContainer}>
<Text style={styles.label}>Sound Effects</Text>
<CustomSwitch
isEnabled={isSoundEffectsEnabled}
onToggle={toggleSoundEffects}
/>
</View>

<Text style={styles.textHeading}>NOTIFICATIONS</Text>
<View style={styles.switchContainer}>
<Text style={styles.label}>All Notifications</Text>
<CustomSwitch
isEnabled={isNotificationsEnabled}
onToggle={toggleNotifications}
/>
</View>
<Button
title="Press Me"
onPress={() => router.push('EditProfile')}
/>
</View>

<Text style={styles.textHeading}>NOTIFICATIONS</Text>
<View style={styles.switchContainer}>
<Text style={styles.label}>All Notifications</Text>
<CustomSwitch
isEnabled={isNotificationsEnabled}
onToggle={toggleNotifications}
<CustomButton
label="Log out"
backgroundColor="white"
onPressHandler={logOut}
/>
</View>
<Button
title="Press Me"
onPress={() => router.push('EditProfile')}
/>

<CustomButton
label="Log out"
backgroundColor="white"
onPressHandler={logOut}
/>
</View>
</ScrollView>
);
}

Expand Down
1 change: 0 additions & 1 deletion frontend/iQMA-Skills-Builder/components/Achievement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const styles = StyleSheet.create({
borderColor: '#5C5776',
borderRadius: 10,
marginTop: 10,
backgroundColor: "#FFFF"
},
achievementImageContainer: {
flex: 1,
Expand Down
10 changes: 10 additions & 0 deletions frontend/iQMA-Skills-Builder/constants/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// styles.js
import { StyleSheet } from 'react-native';
import { Colors } from './Colors';

export const globalStyles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.light.background,
},
});

0 comments on commit 2c9e733

Please sign in to comment.