import classNames from 'classnames' import { Text } from 'components/Text' import { FormattedNumber } from 'components/FormattedNumber' interface Props { title: string data?: PositionsData[] } export const PositionsList = (props: Props) => { if (!props?.data || props.data?.length === 0) return null const arrayKeys = Object.keys(props.data[0]) return (
{props.title}
<>
{arrayKeys.map((label, index) => ( {label} ))}
{props.data && props.data.map((positionsData: PositionsData, index) => (
{arrayKeys.map((key, index) => { if (index === 0) return ( {positionsData[key].amount} ) return ( {positionsData[key].format && positionsData[key].format === 'number' ? ( ) : ( positionsData[key]?.amount || '' )} ) })}
))}
) }