import Link from 'next/link' import Image from 'next/image' import { Grantee } from '.' import { Row } from 'web/components/layout/row' import { sumBy } from 'lodash' import { formatLargeNumber, formatMoney } from 'common/util/format' export default function GranteeCard(props: { grantee: Grantee }) { const { grantee } = props const { slug, photo, preview } = grantee // sumBy grantee.grantsReceived amount const raised = sumBy(grantee.grantsReceived, (grant) => grant.amount) return (
{photo ? ( ) : (
{grantee.name}
)}
{preview}
{raised > 0 && ( {formatUsd(raised)} raised {/* {match && ( +{formatUsd(match)} match )} */} )}
) } function formatUsd(usd: number) { return `$${formatLargeNumber(usd)}` }