diff --git a/LeftOvers/navigation/BottomBar.tsx b/LeftOvers/navigation/BottomBar.tsx index 804f662..56f9419 100644 --- a/LeftOvers/navigation/BottomBar.tsx +++ b/LeftOvers/navigation/BottomBar.tsx @@ -16,7 +16,7 @@ import DarkIcon from '../assets/images/moon.png'; export default function BottomBar({ state, descriptors, navigation }) { const {theme, toggleTheme} = useContext(ThemeContext); - const {colors, toggleColor} = useContext(ColorContext) + const {colors, toggleColors} = useContext(ColorContext) const [iconThemeButton, setThemeIconButton] = useState(( theme === 'dark' ) ? LightIcon : DarkIcon) const [textThemeButton, setTextThemeButton] = useState(( theme === 'dark' ) ? 'Light' : 'Dark'); @@ -25,12 +25,12 @@ export default function BottomBar({ state, descriptors, navigation }) { setThemeIconButton(DarkIcon); setTextThemeButton("Dark"); toggleTheme('light'); - toggleColor(LightTheme) + toggleColors(LightTheme) } else { setThemeIconButton(LightIcon); setTextThemeButton("Light"); toggleTheme('dark') - toggleColor(DarkTheme) + toggleColors(DarkTheme) } console.log('TextThemeButton is now: ' + textThemeButton); } diff --git a/LeftOvers/navigation/HomeStackScreen.tsx b/LeftOvers/navigation/HomeStackScreen.tsx index 631a7c1..6864e34 100644 --- a/LeftOvers/navigation/HomeStackScreen.tsx +++ b/LeftOvers/navigation/HomeStackScreen.tsx @@ -7,6 +7,7 @@ import Profiles from '../screens/Profiles'; import CreateProfile from '../screens/CreateProfile'; import ModifyProfile from '../screens/ModifyProfile'; import ThemeContext from '../theme/ThemeContext'; +import ColorContext from '../theme/ColorContext'; import { HeaderTitle } from './Utils'; import appLogo from '../assets/images/logo.png'; @@ -23,6 +24,7 @@ function AppIcon() { export default function HomeStackScreen() { const {theme, toggleTheme} = useContext(ThemeContext) + const {colors, toggleColors} = useContext(ColorContext) return ( @@ -30,7 +32,7 @@ export default function HomeStackScreen() { name='Home' component={HomePage} options={{ - headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'}, + headerStyle: {backgroundColor: colors.cardBackground}, headerLeft: () => ( @@ -50,7 +52,7 @@ export default function HomeStackScreen() { name='Profiles' component={Profiles} options={{ - headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'}, + headerStyle: {backgroundColor: colors.cardBackground}, headerTitle: () => ( ) @@ -60,7 +62,7 @@ export default function HomeStackScreen() { name='ProfileModification' component={ModifyProfile} options={{ - headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'}, + headerStyle: {backgroundColor: colors.cardBackground}, headerTitle: () => ( ) diff --git a/LeftOvers/navigation/Utils.tsx b/LeftOvers/navigation/Utils.tsx index ddcf8d3..0a6c072 100644 --- a/LeftOvers/navigation/Utils.tsx +++ b/LeftOvers/navigation/Utils.tsx @@ -1,16 +1,16 @@ import React, { useContext } from 'react'; import { Text, StyleSheet } from 'react-native'; -import ThemeContext from '../theme/ThemeContext'; +import ColorContext from '../theme/ColorContext'; export function HeaderTitle(props) { - const {theme, toggleTheme} = useContext(ThemeContext); + const {colors, toggleColors} = useContext(ColorContext) const styles = StyleSheet.create({ headerTitle: { fontSize: 20, fontWeight: "bold", - color: theme === 'light' ? '#3F3C42' : '#F2F0E4', + color: colors.cardDetail, } }) diff --git a/LeftOvers/screens/HomePage.tsx b/LeftOvers/screens/HomePage.tsx index ffe651e..8de9bbe 100644 --- a/LeftOvers/screens/HomePage.tsx +++ b/LeftOvers/screens/HomePage.tsx @@ -6,179 +6,180 @@ import {SafeAreaProvider} from 'react-native-safe-area-context'; import ValidateButton from '../components/ValidateButton'; import ProfileSelection from '../components/ProfileSelection'; import FoodElementText from '../components/FoodElementText'; -import ThemeContext from '../theme/ThemeContext'; +import ColorContext from '../theme/ColorContext'; import bracketLeft from '../assets/images/angle_bracket_left.png'; import bracketRight from '../assets/images/angle_bracket_right.png'; + export default function HomePage({ navigation, props }) { - const {theme, toggleTheme} = useContext(ThemeContext); + const {colors, toggleColors} = useContext(ColorContext); - const profiles = [ - {name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"}, - {name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"}, - {name: "Goro Takemura", avatar: "plus_small.png", isActive: "none"}, - {name: "David Martinez", avatar: "plus_small.png", isActive: "flex"}, - ] + const profiles = [ + {name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"}, + {name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"}, + {name: "Goro Takemura", avatar: "plus_small.png", isActive: "none"}, + {name: "David Martinez", avatar: "plus_small.png", isActive: "flex"}, + ] - const ingredientList = [{title: "Carrot"}, {title: "Potato"}, {title: "Peach"}] + const ingredientList = [{title: "Carrot"}, {title: "Potato"}, {title: "Peach"}] - const [cpt, setCpt] = useState(0); - const decreaseCounter = () => { - if (cpt > 0) { - setCpt(cpt - 1); - } - else { - setCpt(ingredientList.length - 1); - } - }; - const increaseCounter = () => { - if (cpt < ingredientList.length - 1) { - setCpt(cpt + 1); - } - else { - setCpt(0); - } - }; + const [cpt, setCpt] = useState(0); + const decreaseCounter = () => { + if (cpt > 0) { + setCpt(cpt - 1); + } + else { + setCpt(ingredientList.length - 1); + } + }; + const increaseCounter = () => { + if (cpt < ingredientList.length - 1) { + setCpt(cpt + 1); + } + else { + setCpt(0); + } + }; - const styles = StyleSheet.create({ - container: { - width: "100%", - flex: 1, - backgroundColor: '#3F3C42', - alignItems: 'center', - justifyContent: 'center', - }, - linearGradient: { - width: "100%", - flex: 1, - padding: "2%", - paddingTop: 0, - }, - separator: { - marginTop: "6%" - }, - - filterBar: { - flexDirection: "row", - width: "85%", - paddingTop: "3%", - paddingBottom: "2%", - alignItems: "flex-end", - justifyContent: "center", - }, - filters: { - fontSize: 20, - color: '#ACA279', - flex: 1, - }, - nbSelected: { - fontSize: 11, - color: "#3F3C42", - textAlign: "right", - }, - - profilesSelection: { - alignItems: 'center', - justifyContent: 'center', - borderRadius: 20, - backgroundColor: '#F2F0E4', - marginHorizontal: "3%", - paddingBottom: "3%", - }, - - welcome: { - alignItems: 'center', - justifyContent: 'center', - borderRadius: 20, - backgroundColor: '#F2F0E4', - paddingVertical: "3%", - paddingHorizontal: "7%", - marginHorizontal: "3%", - }, - text: { - fontSize: 20, - color: '#ACA279', - }, - name: { - fontSize: 20, - fontWeight: "bold", - color: '#59BDCD', - }, - - ingredientSelection: { - width: "90%", - alignItems: 'center', - justifyContent: 'center', - borderRadius: 20, - backgroundColor: '#E3DEC9', - borderWidth: 2, - borderColor: "#ACA279", - padding: "2%" - } - }); + const styles = StyleSheet.create({ + container: { + width: "100%", + flex: 1, + backgroundColor: '#3F3C42', + alignItems: 'center', + justifyContent: 'center', + }, + linearGradient: { + width: "100%", + flex: 1, + padding: "2%", + paddingTop: 0, + }, + separator: { + marginTop: "6%" + }, + + filterBar: { + flexDirection: "row", + width: "85%", + paddingTop: "3%", + paddingBottom: "2%", + alignItems: "flex-end", + justifyContent: "center", + }, + filters: { + fontSize: 20, + color: colors.cardTitle, + flex: 1, + }, + nbSelected: { + fontSize: 11, + color: colors.cardDetail, + textAlign: "right", + }, + + profilesSelection: { + alignItems: 'center', + justifyContent: 'center', + borderRadius: 20, + backgroundColor: colors.cardBackground, + marginHorizontal: "3%", + paddingBottom: "3%", + }, + + welcome: { + alignItems: 'center', + justifyContent: 'center', + borderRadius: 20, + backgroundColor: colors.cardBackground, + paddingVertical: "3%", + paddingHorizontal: "7%", + marginHorizontal: "3%", + }, + text: { + fontSize: 20, + color: colors.welcomeText, + }, + name: { + fontSize: 20, + fontWeight: "bold", + color: colors.welcomeName, + }, + + ingredientSelection: { + width: "90%", + alignItems: 'center', + justifyContent: 'center', + borderRadius: 20, + backgroundColor: '#E3DEC9', + borderWidth: 2, + borderColor: "#ACA279", + padding: "2%" + } + }); - return ( - - - - - - - - Welcome - Rayhân - , + return ( + + + + + + + + Welcome + Rayhân + , + + Glad to see you again! - Glad to see you again! - - - - - - Profiles - 2 selected - - - - navigation.navigate('Profiles')}/> - - - - - Ingredient Stocks + + + + Profiles + 2 selected + + + + + navigation.navigate('Profiles')}/> - - console.log('ManageStocks')}/> - - - - - Cooking + + + + Ingredient Stocks + + + console.log('ManageStocks')}/> - - - Selected Ingredient - - - - - - - - + + + + Cooking + + + + Selected Ingredient + + + + + + + + + + + console.log('Chnge Selected Ingredient')}/> + + console.log('Go and search for recipe')}/> - - console.log('Chnge Selected Ingredient')}/> - - console.log('Go and search for recipe')}/> - - - - - - ); + + + + + ); } diff --git a/LeftOvers/theme/ColorContext.tsx b/LeftOvers/theme/ColorContext.tsx index 5cad2ce..7b82415 100644 --- a/LeftOvers/theme/ColorContext.tsx +++ b/LeftOvers/theme/ColorContext.tsx @@ -1,11 +1,11 @@ import React, {createContext, useState, useEffect} from 'react'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { DarkTheme, LightTheme, Theme } from './colors'; +import { LightTheme, Theme } from './colors'; interface ColorContextType { colors: Theme, - toggleColor: (Theme) => void + toggleColors: (Theme) => void }; const ColorContext = createContext(null); @@ -27,13 +27,13 @@ export const ColorProvider = ({ children }) => { getColors(); }, []); - const toggleColor = (newColors: Theme) => { + const toggleColors = (newColors: Theme) => { setColors(newColors); AsyncStorage.setItem('colors', JSON.stringify(newColors)) }; return ( - + {children} ); diff --git a/LeftOvers/theme/colors.ts b/LeftOvers/theme/colors.ts index 2ce4786..be3fbd2 100644 --- a/LeftOvers/theme/colors.ts +++ b/LeftOvers/theme/colors.ts @@ -23,6 +23,10 @@ export interface Theme { ingredientBackground: string, ingredientContent: string, ingredientBorder: string, + buttonBackground: string, + buttonDetail: string, + welcomeText: string, + welcomeName: string, } export const LightTheme : Theme = { @@ -38,13 +42,17 @@ export const LightTheme : Theme = { ingredientBackground: Pearl, ingredientBorder: EerieBlack, ingredientContent: Jet, + buttonBackground: Pearl, + buttonDetail: Moonstone, + welcomeText: Ecru, + welcomeName: Moonstone } export const DarkTheme : Theme = { primary: EerieBlack, primaryComplement: Jet, cardBackground: Jet, - cardTitle: Ecru, + cardTitle: Alabaster, cardDetail: Alabaster, cardElementBackground: SteelBlue, cardElementText: Jet, @@ -52,6 +60,10 @@ export const DarkTheme : Theme = { cardElementBorder: SteelBlue, ingredientBackground: EerieBlack, ingredientBorder: SteelBlue, - ingredientContent: Alabaster + ingredientContent: Alabaster, + buttonBackground: Jet, + buttonDetail: CarolinaBlue, + welcomeText: SteelBlue, + welcomeName:Alabaster }