everything refactored
This commit is contained in:
parent
0240eb2562
commit
62e71d1b49
10 changed files with 407 additions and 50 deletions
38
components/stats/BudgetRemaining.tsx
Normal file
38
components/stats/BudgetRemaining.tsx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import React from 'react';
|
||||
import { Text, StyleSheet } from 'react-native';
|
||||
import { useTheme } from '../../app/contexts/ThemeContext';
|
||||
|
||||
interface BudgetRemainingProps {
|
||||
budget: number;
|
||||
spent: number;
|
||||
}
|
||||
|
||||
const BudgetRemaining: React.FC<BudgetRemainingProps> = ({ budget, spent }) => {
|
||||
const { colors, theme } = useTheme();
|
||||
|
||||
const remaining = budget - spent;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
margin: 10,
|
||||
borderRadius: 5,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
text: {
|
||||
fontSize: 26,
|
||||
color: colors.primaryText,
|
||||
},
|
||||
boldText: {
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Text style={styles.text}>
|
||||
You have <Text style={styles.boldText}>{remaining.toFixed(2)}€</Text> left.
|
||||
</Text>
|
||||
);
|
||||
};
|
||||
|
||||
export default BudgetRemaining;
|
||||
Reference in a new issue