mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-23 01:39:40 +01:00
27 lines
593 B
TypeScript
27 lines
593 B
TypeScript
|
import styles from './Price.module.css'
|
||
|
import { usePrices } from '@/features/prices'
|
||
|
import { PriceChange } from './PriceChange'
|
||
|
|
||
|
export function Price({
|
||
|
price,
|
||
|
priceChange
|
||
|
}: {
|
||
|
price: number
|
||
|
priceChange?: number
|
||
|
}) {
|
||
|
const { isValidating, isLoading } = usePrices()
|
||
|
|
||
|
const feedbackClasses = isLoading
|
||
|
? 'isLoading'
|
||
|
: isValidating
|
||
|
? 'isValidating'
|
||
|
: ''
|
||
|
|
||
|
return (
|
||
|
<p className={styles.price}>
|
||
|
<span className={`${styles.fiat} ${feedbackClasses}`}>${price} </span>
|
||
|
{priceChange ? <PriceChange priceChange={priceChange} /> : null}
|
||
|
</p>
|
||
|
)
|
||
|
}
|