import { useSignal } from 'https://esm.sh/v135/@preact/signals@1.2.2/X-ZS8q/dist/signals.js' import { JSX } from 'preact' import { Budget, currency, percentage } from '../models.ts' interface IconButtonProps { active?: boolean text?: string icon?: JSX.Element } function IconButton( { icon, children, active, ...props }: & IconButtonProps & JSX.HTMLAttributes, ) { return ( ) } function BudgetCard( { budget, ...props }: & { budget: Budget } & JSX.HTMLAttributes, ) { return (
{budget.name}: {currency(budget.spent)} / {currency(budget.target)}{' '} ({percentage(budget.spent / budget.target)})
) } export default function Dashboard() { const activeNavItemIndex = useSignal(0) const budgets: Budget[] = [ { name: 'Groceries', 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 = [ { text: 'Some Text', icon: ( ), }, { text: 'Some Text', icon: ( ), }, { text: 'Some Text', icon: ( ), }, ] return (
{budgets.map((budget, _i) => )}
) }