Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated ActionCard.js to TS #6512

Merged
merged 3 commits into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/components/ActionCard.js → src/components/ActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const ChildrenContainer = styled.div`
margin-top: 2rem;
`

const ImageWrapper = styled.div`
const ImageWrapper = styled.div<{
isRight: boolean | undefined
isBottom: boolean | undefined
}>`
display: flex;
flex-direction: row;
justify-content: ${(props) => (props.isRight ? `flex-end` : `center`)};
Expand Down Expand Up @@ -62,7 +65,18 @@ const Card = styled(Link)`
}
`

const ActionCard = ({
export interface IProps {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You made everything optional but there are some props that we do want to make them as required.
How about this?

export interface IProps {
  to: string
  alt?: string
  image: string
  title: string
  description: string
  className?: string
  isRight?: boolean
  isBottom?: boolean
}

to: string
alt?: string
image: string
title: string
description: string
className?: string
isRight?: boolean
isBottom?: boolean
}

const ActionCard: React.FC<IProps> = ({
to,
alt,
image,
Expand All @@ -71,7 +85,7 @@ const ActionCard = ({
children,
className,
isRight,
isBottom = true,
isBottom = true
}) => {
const isImageURL = typeof image === "string" && image.includes("http")
return (
Expand Down