Spaces:
Sleeping
Sleeping
Download src/lib/components/MoneyText.svelte from assafvayner/splitwise: direct link, hf CLI and curl.
- Browser
- Download file 537 Bytes
-
https://huggingface.co/spaces/assafvayner/splitwise/resolve/main/src/lib/components/MoneyText.svelte
- Command line
-
hf download hf://spaces/assafvayner/splitwise/src/lib/components/MoneyText.svelte
-
curl -L -o MoneyText.svelte https://huggingface.co/spaces/assafvayner/splitwise/resolve/main/src/lib/components/MoneyText.svelte
537 Bytes
| <script lang="ts"> | |
| import { formatCents } from '$lib/domain/money'; | |
| let { | |
| cents, | |
| currency, | |
| signed = false, | |
| class: className = '' | |
| }: { cents: number; currency: string; signed?: boolean; class?: string } = $props(); | |
| const text = $derived( | |
| signed && cents > 0 ? `+${formatCents(cents, currency)}` : formatCents(cents, currency) | |
| ); | |
| const tone = $derived( | |
| !signed ? '' : cents > 0 ? 'text-green-700' : cents < 0 ? 'text-red-700' : 'text-gray-500' | |
| ); | |
| </script> | |
| <span class="tabular-nums {tone} {className}">{text}</span> | |