Posts

Showing posts from December, 2024

bitcoin price tracker

 import React, { useEffect, useRef } from 'react'; import { TrendingUp, TrendingDown } from 'lucide-react'; import { formatPrice, formatPercentage } from '../utils/formatters'; interface PriceDisplayProps {   price: number;   change24h: number; } export const PriceDisplay: React.FC<PriceDisplayProps> = ({ price, change24h }) => {   const isPositive = change24h >= 0;   const prevPriceRef = useRef(price);   const priceElementRef = useRef<HTMLSpanElement>(null);      useEffect(() => {     if (price !== prevPriceRef.current && priceElementRef.current) {       priceElementRef.current.classList.add('price-flash');              setTimeout(() => {         if (priceElementRef.current) {           priceElementRef.current.classList.remove('price-flash');         }       }, 1000); ...