diff --git a/components/BalanceCard.tsx b/components/BalanceCard.tsx new file mode 100644 index 0000000..596ab26 --- /dev/null +++ b/components/BalanceCard.tsx @@ -0,0 +1,92 @@ +import React from 'react'; +import { View, Text, StyleSheet } from 'react-native'; +import { COLORS, FONTS } from '../constants/theme'; +import { BalanceInfo } from '../types'; +import { formatRupiah } from '../utils/helpers'; + +interface BalanceCardProps { + balance: BalanceInfo; +} + +export const BalanceCard: React.FC = ({ balance }) => { + return ( + + + + Pemasukan + + +{formatRupiah(balance.income)} + + + + Pengeluaran + + -{formatRupiah(balance.expense)} + + + + + + Total Saldo + + {formatRupiah(balance.total)} + + + + ); +}; + +const styles = StyleSheet.create({ + container: { + backgroundColor: COLORS.card, + margin: 16, + padding: 20, + borderRadius: 12, + shadowColor: '#000', + shadowOffset: { width: 0, height: 2 }, + shadowOpacity: 0.1, + shadowRadius: 4, + elevation: 3, + }, + row: { + flexDirection: 'row', + justifyContent: 'space-between', + }, + col: { + flex: 1, + alignItems: 'center', + }, + label: { + fontSize: FONTS.small, + color: COLORS.textSecondary, + marginBottom: 4, + }, + amount: { + fontSize: FONTS.regular, + fontWeight: '600', + }, + income: { + color: COLORS.income, + }, + expense: { + color: COLORS.expense, + }, + divider: { + height: 1, + backgroundColor: COLORS.border, + marginVertical: 16, + }, + totalContainer: { + alignItems: 'center', + }, + totalLabel: { + fontSize: FONTS.small, + color: COLORS.textSecondary, + marginBottom: 4, + }, + totalAmount: { + fontSize: FONTS.xlarge, + fontWeight: 'bold', + color: COLORS.text, + }, +}); \ No newline at end of file