import { formatDateAxis } from '@components/shared/DetailedAreaChart' import { useTheme } from 'next-themes' import { useMemo } from 'react' import { Area, AreaChart, ResponsiveContainer, XAxis, YAxis } from 'recharts' import { COLORS } from 'styles/colors' import { formatFixedDecimals } from 'utils/numbers' const PriceChart = ({ prices, daysToShow, }: { prices: number[][] daysToShow: number }) => { const { theme } = useTheme() const change = useMemo(() => { return prices[prices.length - 1][1] - prices[0][1] }, [prices]) return (
= 0 ? COLORS.UP[theme] : COLORS.DOWN[theme] } stopOpacity={0.15} /> = 0 ? COLORS.UP[theme] : COLORS.DOWN[theme] } stopOpacity={0} /> = 0 ? COLORS.UP[theme] : COLORS.DOWN[theme]} strokeWidth={1.5} fill="url(#gradientArea)" /> formatDateAxis(d, daysToShow)} /> formatFixedDecimals(x, true)} tickLine={false} />
) } export default PriceChart