diff --git a/app/index.tsx b/app/index.tsx index 27ced03..198b8be 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,5 +1,9 @@ import { StyleSheet, View, Text } from 'react-native'; -import {useThemeColor} from "../hooks/hooks"; +import { useThemeColor } from "../hooks/hooks"; +import { SafeAreaView } from 'react-native-safe-area-context'; +import { ExpenseItem } from '../components'; +import { FlatList } from 'react-native-gesture-handler'; +import { ExpenseItemProps } from '../components/home/expenseItem/expenseItem'; export default function Page() { @@ -15,11 +19,33 @@ export default function Page() { fontWeight: "bold" } }); + + const data = [ + {id:"1",category: "Category 1", color: "blue", date:"01.01.2023 18:00", title:"Super fancy sepnding with long name that will not display", value: "€ 30,00"}, + {id:"2",category: "Category 2", color: "red", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"3",category: "Category 3", color: "green", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"4",category: "Category 4", color: "orange", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"5",category: "Category 1", color: "blue", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"6",category: "Category 2", color: "red", date:"01.01.2023 18:00", title:"Super fancy sepnding with long name that will not display", value: "€ 30,00"}, + {id:"7",category: "Category 3", color: "green", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"8",category: "Category 4", color: "orange", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"9",category: "Category 1", color: "blue", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"10" ,category: "Category 2", color: "red", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"11" ,category: "Category 3", color: "green", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + {id:"12" ,category: "Category 4", color: "orange", date:"01.01.2023 18:00", title:"Super fancy sepnding", value: "€ 30,00"}, + ] return ( - - Home - - ); + + } + keyExtractor={item => item.id} + ItemSeparatorComponent={()=>} + > + + + + ); } \ No newline at end of file diff --git a/components/common/customCard/CustomCard.tsx b/components/common/customCard/CustomCard.tsx new file mode 100644 index 0000000..99ebaa3 --- /dev/null +++ b/components/common/customCard/CustomCard.tsx @@ -0,0 +1,23 @@ +import { View, Text, StyleSheet } from 'react-native' +import React from 'react' +import { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes' +import { useThemeColor } from '../../../hooks/hooks' +import { SHADOWS } from '../../../constants/theme' + +export default function CustomCard(props : ViewProps) { + return ( + + {props.children} + + ) +} + +const styles = StyleSheet.create({ + container:{ + flexDirection: "row", + alignItems: "stretch", + alignContent: "space-between", + borderRadius: 20, + marginHorizontal: 10 + } +}) \ No newline at end of file diff --git a/components/home/expenseItem/expenseItem.tsx b/components/home/expenseItem/expenseItem.tsx new file mode 100644 index 0000000..acd7821 --- /dev/null +++ b/components/home/expenseItem/expenseItem.tsx @@ -0,0 +1,61 @@ +import { View, Text, StyleSheet, ColorValue } from 'react-native' +import React from 'react' +import { useThemeColor } from '../../../hooks/hooks'; +import CustomCard from "../../common/customCard/CustomCard"; +import { SIZES } from '../../../constants/theme'; + +export type ExpenseItemProps = {color: ColorValue, category: string, title: string, date: string, value : string} +export default function ExpenseItem(itemProps : ExpenseItemProps) { + const textColor = useThemeColor("primaryText"); + const backgroundColor = useThemeColor("backgroundColor") + return ( + + + + {itemProps.category} + {itemProps.title} + {itemProps.date} + + + {itemProps.value} + + + + + ) +} + +const styles = StyleSheet.create({ + colorTip: { + width: 20, + borderTopLeftRadius: 20, + borderBottomLeftRadius: 20, + }, + + textSection: { + flexDirection: "column", + alignContent: "space-between", + alignItems:"flex-start", + paddingLeft: 10, + flex:1, + alignSelf: "stretch", + paddingVertical: 5 + }, + valueSection: { + justifyContent:"center", + borderTopRightRadius: 20, + borderBottomRightRadius: 20, + } +}) \ No newline at end of file diff --git a/components/index.jsx b/components/index.jsx new file mode 100644 index 0000000..7d1f5b7 --- /dev/null +++ b/components/index.jsx @@ -0,0 +1,7 @@ +//home +import ExpenseItem from "./home/expenseItem/expenseItem" + +export { + ExpenseItem +} + diff --git a/constants/theme.ts b/constants/theme.ts new file mode 100644 index 0000000..413df5b --- /dev/null +++ b/constants/theme.ts @@ -0,0 +1,18 @@ +const SIZES = { + small: 12, + normal: 17, + large: 20, + xxLarge: 30 +} + +const SHADOWS = { + light: { + shadowColor: "#ADB7C3", + shadowRadius: 20, + elevation: 10, + shadowOpacity: 0.6, + shadowOffset: { width: 1, height: 1 } + } +} + +export {SIZES, SHADOWS} \ No newline at end of file