Skip to content

Commit

Permalink
refactor(cardlist): migrate component from js to tsx
Browse files Browse the repository at this point in the history
add typed props for the card list and switch from
js file to typescript react component

Refs: ethereum#6392
  • Loading branch information
Mousticke committed Jun 3, 2022
1 parent f3efc79 commit 7baeb05
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/components/CardList.js → src/components/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,27 @@ const Image = styled(GatsbyImage)`
margin-top: 4px;
`

const CardList = ({ content, className, clickHandler }) => (
export interface ICardListItem {
title: string
description: string
caption?: string
link: string
image?: string
alt?: string
id: string | number
}

export interface IProps {
content: Array<ICardListItem>
className?: string
clickHandler?: (idx: string | number) => void
}

const CardList: React.FC<IProps> = ({
content,
className,
clickHandler = () => null,
}) => (
<Table className={className}>
{content.map((listItem, idx) => {
const { title, description, caption, link, image, alt, id } = listItem
Expand Down

0 comments on commit 7baeb05

Please sign in to comment.