mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-21 06:56:12 +01:00
Show the impact of an expense on the active user's balance (#139)
* Add devcontainer configuration for codespace support * Show the impact of an expense on the active user's balance * Run prettier * Put the balance on a different line --------- Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
31
src/components/money.tsx
Normal file
31
src/components/money.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
'use client'
|
||||
import { cn, formatCurrency } from '@/lib/utils'
|
||||
|
||||
type Props = {
|
||||
currency: string
|
||||
amount: number
|
||||
bold?: boolean
|
||||
colored?: boolean
|
||||
}
|
||||
|
||||
export function Money({
|
||||
currency,
|
||||
amount,
|
||||
bold = false,
|
||||
colored = false,
|
||||
}: Props) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
colored && amount <= 1
|
||||
? 'text-red-600'
|
||||
: colored && amount >= 1
|
||||
? 'text-green-600'
|
||||
: '',
|
||||
bold && 'font-bold',
|
||||
)}
|
||||
>
|
||||
{formatCurrency(currency, amount)}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user