Skip to content

Commit

Permalink
Rename component, fix missing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kpyszkowski committed Apr 18, 2024
1 parent 55cfc58 commit 25a0d69
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dapp/src/pages/LandingPage/ValueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const valueDecorator: SystemStyleObject = {
mx: 6,
}

function IconCardBase(props: IconCardProps) {
function ValueCardBase(props: IconCardProps) {
const { header, value, footer = [], ...restProps } = props
const isFooterValid = footer.every(
(footerItem) => React.isValidElement(footerItem) && footerItem.type === Box,
Expand All @@ -51,11 +51,17 @@ function IconCardBase(props: IconCardProps) {
{value}
</CardBody>
{footer.length > 0 && (
<CardFooter>{footer.map((footerItem) => footerItem)}</CardFooter>
<CardFooter>
{footer.map((footerItem, index) => (
// This is never rerendered, index key is fine
// eslint-disable-next-line react/no-array-index-key
<React.Fragment key={index}>{footerItem}</React.Fragment>
))}
</CardFooter>
)}
</Card>
)
}

const ValueCard = Object.assign(IconCardBase, { FooterItem: Box })
const ValueCard = Object.assign(ValueCardBase, { FooterItem: Box })
export default ValueCard

0 comments on commit 25a0d69

Please sign in to comment.