import { JSX } from 'preact/jsx-runtime' import { Budget } from '../models.ts' import { Currency } from '../components/Currency.tsx' import { Percentage } from '../components/Percentage.tsx' import { Component } from 'https://esm.sh/stable/preact@10.19.6/denonext/preact.mjs' function BudgetCardLit( { budget, ...props }: & { budget: Budget } & JSX.HTMLAttributes, ) { const remainingRatio = 1.0 - (budget.spent / budget.target) const bgColor = remainingRatio < 0 ? 'bg-red' : 'bg-green' const textColor = remainingRatio < 0 ? 'text-red' : 'text-green' return (

{budget.name}


of{' '} {' spent '} ( remaining)
{ /* */ }
) } export function BudgetCard( { budget, ...props }: & { budget: Budget } & JSX.HTMLAttributes, ) { const remainingRatio = 1.0 - (budget.spent / budget.target) const bgClass = (remainingRatio < 0 ? 'bg-red' : 'bg-green') + ' opacity-10' const accentTextClass = remainingRatio < 0 ? 'text-red' : 'text-green' return ( {remainingRatio >= 0 ? ` left ` : ` over `} } {...props} > of{' '} {' spent '} ( remaining) ) } interface ProgressBarCardProps { heading: string subheading: JSX.Element bgClass: string accentTextClass: string ratio: number } export function ProgressBarCard( { heading, subheading, bgClass, accentTextClass, ratio, children, ...props }: & ProgressBarCardProps & JSX.HTMLAttributes, ) { return (

{heading}

{subheading}
{children}
) }