This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
interaktive-systeme/components/home/expenseItem.tsx
Thomas Schleicher 69610de100 Resolve "Budget"
2024-01-02 12:49:13 +00:00

60 lines
No EOL
1.8 KiB
TypeScript

import React from 'react';
import { ColorValue, StyleSheet, Text, View } from 'react-native';
import { SIZES } from '../../constants/theme';
import CustomCard from "../common/CustomCard";
import { useTheme } from '../../app/contexts/ThemeContext';
export type ExpenseItemProps = {color: ColorValue, category: string, title: string, date: string, value : string}
export default function ExpenseItem(itemProps : ExpenseItemProps) {
const { colors } = useTheme();
return (
<CustomCard>
<View style={[styles.colorTip, {backgroundColor: itemProps.color}]}></View>
<View style={[styles.textSection, {backgroundColor: colors.backgroundColor}]}>
<Text style={{
fontSize: SIZES.normal,
color: colors.primaryText
}} numberOfLines={1}>{itemProps.category}</Text>
<Text style={{
fontSize: SIZES.large,
color: colors.primaryText
}} numberOfLines={1}>{itemProps.title}</Text>
<Text style={{
fontSize: SIZES.small,
color: colors.primaryText
}} numberOfLines={1}>{itemProps.date}</Text>
</View>
<View style={[styles.valueSection, {backgroundColor: colors.backgroundColor}]}>
<Text style={{
fontSize: SIZES.xxLarge,
color: colors.primaryText
}} numberOfLines={1}>{itemProps.value}</Text>
</View>
</CustomCard>
)
}
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,
}
})