From e0a73c503292753b2329a3b8fcad5421c0680cff Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 24 Aug 2024 08:10:43 -0500 Subject: [PATCH] Budgets wip --- islands/Dashboard.tsx | 108 +++++++++++++++++++++++++++++++++++------- models.ts | 18 +++++++ 2 files changed, 110 insertions(+), 16 deletions(-) create mode 100644 models.ts diff --git a/islands/Dashboard.tsx b/islands/Dashboard.tsx index 25f9a93..8046d22 100644 --- a/islands/Dashboard.tsx +++ b/islands/Dashboard.tsx @@ -1,40 +1,114 @@ import { useSignal } from 'https://esm.sh/v135/@preact/signals@1.2.2/X-ZS8q/dist/signals.js' import { JSX } from 'preact' -// interface Budget { -// name: string -// target: number -// buffer?: number -// } +import { Budget } from '../models.ts' interface IconButtonProps { active?: boolean - text: string - icon: string + text?: string + icon?: JSX.Element } function IconButton( - { icon, text, active, ...props }: + { icon, children, active, ...props }: & IconButtonProps & JSX.HTMLAttributes, ) { return ( + ) +} + +function BudgetCard( + { children, ...props }: + & { budget: Budget } + & JSX.HTMLAttributes, +) { + return ( + ) } export default function Dashboard() { const activeNavItemIndex = useSignal(0) + const budgets: Budget[] = [ + { + name: 'Groceries', + target: 1000, + spent: 367.97, + }, + ] const navItems = [ - { text: 'Some Text', icon: 'ICON' }, - { text: 'Some Text', icon: 'ICON' }, - { text: 'Some Text', icon: 'ICON' }, + { + text: 'Some Text', + icon: ( + + + + ), + }, + { + text: 'Some Text', + icon: ( + + + + ), + }, + { + text: 'Some Text', + icon: ( + + + + ), + }, ] return ( @@ -44,7 +118,7 @@ export default function Dashboard() { diff --git a/models.ts b/models.ts new file mode 100644 index 0000000..a2b2a91 --- /dev/null +++ b/models.ts @@ -0,0 +1,18 @@ +export interface Budget { + name: string + target: number + buffer?: number + spent: number +} + +export interface Bucket { + name: string + target: number + saved: number +} + +export interface Transaction { + description: string + budget: string + amount: number +}