diff --git a/islands/Dashboard.tsx b/islands/Dashboard.tsx index 8046d22..5379936 100644 --- a/islands/Dashboard.tsx +++ b/islands/Dashboard.tsx @@ -1,7 +1,7 @@ import { useSignal } from 'https://esm.sh/v135/@preact/signals@1.2.2/X-ZS8q/dist/signals.js' import { JSX } from 'preact' -import { Budget } from '../models.ts' +import { Budget, currency, percentage } from '../models.ts' interface IconButtonProps { active?: boolean @@ -15,30 +15,47 @@ function IconButton( ) { return ( ) } function BudgetCard( - { children, ...props }: + { budget, ...props }: & { budget: Budget } & JSX.HTMLAttributes, ) { return ( - +
+ {budget.name}: {currency(budget.spent)} / {currency(budget.target)}{' '} + ({percentage(budget.spent / budget.target)}) +
+ + ) } @@ -50,6 +67,21 @@ export default function Dashboard() { target: 1000, spent: 367.97, }, + { + name: 'Fast Food', + target: 300, + spent: 420.69, + }, + { + name: 'Insurance', + target: 220.44, + spent: 0, + }, + { + name: 'Mortgage', + target: 1310.47, + spent: 1310.47, + }, ] const navItems = [ { @@ -113,11 +145,11 @@ export default function Dashboard() { return (
-
- This is the main content +
+ {budgets.map((budget, _i) => )}
-