refactored into budgetHeader component
This commit is contained in:
parent
7c165fb691
commit
94e9b5738e
3 changed files with 43 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';
|
import { SafeAreaView, StyleSheet, View } from 'react-native';
|
||||||
import { FlatList } from 'react-native-gesture-handler';
|
import { FlatList } from 'react-native-gesture-handler';
|
||||||
import { SearchBar } from '../../../components';
|
import { BudgetHeader } from '../../../components';
|
||||||
import CategoryItem from '../../../components/budget/categoryItem';
|
import CategoryItem from '../../../components/budget/categoryItem';
|
||||||
import useFetch from '../../../hooks/useFetch';
|
import useFetch from '../../../hooks/useFetch';
|
||||||
import { useThemeColor } from '../../../hooks/useThemeColor';
|
import { useThemeColor } from '../../../hooks/useThemeColor';
|
||||||
|
|
@ -14,10 +14,8 @@ export default function Page() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={[styles.safeAreaViewStyle, {backgroundColor: containerColor}]}>
|
<SafeAreaView style={[styles.safeAreaViewStyle, {backgroundColor: containerColor}]}>
|
||||||
<View>
|
|
||||||
<Text style={[{color: textColor}]}>Expense View</Text>
|
<BudgetHeader/>
|
||||||
<SearchBar placeholder='Search...'></SearchBar>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<FlatList
|
<FlatList
|
||||||
data={data}
|
data={data}
|
||||||
|
|
@ -37,5 +35,5 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
itemSeperatorStyle: {
|
itemSeperatorStyle: {
|
||||||
marginVertical: 5,
|
marginVertical: 5,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
35
components/budget/budgetHeader.tsx
Normal file
35
components/budget/budgetHeader.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { StyleSheet, Text, View } from "react-native";
|
||||||
|
import { useThemeColor } from "../../hooks/useThemeColor";
|
||||||
|
import SearchBar from "../common/SearchBar";
|
||||||
|
|
||||||
|
const BudgetHeader = () => {
|
||||||
|
const primaryTextColor = useThemeColor("primaryText");
|
||||||
|
const secondaryTextColor = useThemeColor("secondaryText");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (<>
|
||||||
|
<View style={styles.containerStyle}>
|
||||||
|
<Text style={[styles.selectedHeaderTextStyle, {color: primaryTextColor}]}>Expense View</Text>
|
||||||
|
<Text style={[styles.defaultHeaderTextStyle, {color: secondaryTextColor}]}>Savings View</Text>
|
||||||
|
</View>
|
||||||
|
<SearchBar placeholder='Search...'></SearchBar>
|
||||||
|
</>);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BudgetHeader;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
selectedHeaderTextStyle: {
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: "bold",
|
||||||
|
},
|
||||||
|
defaultHeaderTextStyle: {
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
containerStyle: {
|
||||||
|
backgroundColor: "blue",
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -11,10 +11,11 @@ import CustomCard from "./common/CustomCard"
|
||||||
|
|
||||||
|
|
||||||
//login
|
//login
|
||||||
|
import BudgetHeader from "./budget/budgetHeader"
|
||||||
import Input from "./login/input"
|
import Input from "./login/input"
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ButtonSetting, CustomCard, ExpenseItem, Input,
|
BudgetHeader, ButtonSetting, CustomCard, ExpenseItem, Input,
|
||||||
LoadingSymbol, Plus,
|
LoadingSymbol, Plus,
|
||||||
SearchBar, ToggleSetting, Welcome
|
SearchBar, ToggleSetting, Welcome
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue