mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-23 01:39:40 +01:00
Matthias Kretschmann
0d08ba807b
* tweak number display * select whole amount upon input focus * handle letter input * number formatting
22 lines
634 B
TypeScript
22 lines
634 B
TypeScript
'use client'
|
|
|
|
import { TriangleUpIcon, TriangleDownIcon } from '@radix-ui/react-icons'
|
|
import styles from './PriceChange.module.css'
|
|
import { useLocale } from '@/features/prices/hooks/use-locale'
|
|
|
|
export function PriceChange({ priceChange }: { priceChange: number }) {
|
|
const locale = useLocale()
|
|
const styleClasses = priceChange > 0 ? styles.positive : styles.negative
|
|
|
|
return (
|
|
<span
|
|
className={`${styles.change} ${styleClasses}`}
|
|
title="24h change"
|
|
data-locale={locale}
|
|
>
|
|
{priceChange > 0 ? <TriangleUpIcon /> : <TriangleDownIcon />}
|
|
{Math.abs(priceChange).toFixed(1)}%
|
|
</span>
|
|
)
|
|
}
|