34 lines
1 KiB
Text
34 lines
1 KiB
Text
package blocks
|
|
|
|
import "github.com/shopspring/decimal"
|
|
import "strings"
|
|
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
|
import "git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
|
|
|
type AccountCardInfo struct {
|
|
SpaceID string
|
|
ID string
|
|
Name string
|
|
Balance decimal.Decimal
|
|
}
|
|
|
|
templ AccountCard(info AccountCardInfo) {
|
|
<a href={ routeurl.URL("page.app.spaces.space.accounts.account.overview", "spaceID", info.SpaceID, "accountID", info.ID) } class="px-2 py-2 block rounded-md hover:bg-sidebar-accent">
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex gap-4 items-center">
|
|
<div class="w-10 h-10 shrink-0 overflow-hidden rounded-md bg-muted flex items-center justify-center">
|
|
{ strings.ToUpper(string(info.Name[0])) }
|
|
</div>
|
|
<div>
|
|
<p class="font-semibold">{ info.Name }</p>
|
|
<p class="text-xs text-muted-foreground">
|
|
${ info.Balance.StringFixedBank(2) }
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="h-full flex items-center justify-center">
|
|
@icon.ChevronRight()
|
|
</div>
|
|
</div>
|
|
</a>
|
|
}
|