asi-calculator/features/prices/components/Price/PriceChange.tsx
Matthias Kretschmann 51143f5980
migrate to biome (#28)
* migrate to biome

* get biome config from @kremalicious/config
2024-07-26 13:16:59 +01:00

22 lines
634 B
TypeScript

'use client'
import { useLocale } from '@/features/prices/hooks/use-locale'
import { TriangleDownIcon, TriangleUpIcon } from '@radix-ui/react-icons'
import styles from './PriceChange.module.css'
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>
)
}