import React from 'react' import useMangoStore from '../stores/useMangoStore' import useMarkPrice from '../hooks/useMarkPrice' import usePrevious from '../hooks/usePrevious' import { isEqual } from '../utils/' import { ArrowUpIcon, ArrowDownIcon } from '@heroicons/react/solid' import UiLock from './UiLock' const MarketHeader = () => { const selectedMarket = useMangoStore((s) => s.selectedMarket) const markPrice = useMarkPrice() return (
{selectedMarket.name}
{markPrice}
) } export default MarketHeader const ChangePercentage = React.memo<{ change: number }>( ({ change }) => { const previousChange: number = usePrevious(change) return (
previousChange ? `text-th-green` : change < previousChange ? `text-th-red` : `text-th-fgd-1` }`} > {change > previousChange && ( )} {change < previousChange && ( )} {change === previousChange &&
} {`${change}%` || '--'}
) }, (prevProps, nextProps) => isEqual(prevProps, nextProps, ['change']) )