import React from "react" import { Button } from "../Button" import { Text } from "../Text" import * as cn from "./Card.styles" interface CardProps { title: string href?: string link?: React.ElementType description?: string btnText?: string imgSrc?: string imgAlt?: string logoSrc?: string logoAlt?: string shadow?: "md" } export function Card(props: CardProps) { const { title, description, imgSrc, imgAlt, logoSrc, logoAlt, shadow, href, link, btnText, } = props const Link = link const cardContent = ( {imgSrc && (
{imgAlt}
{ Link && href && logoSrc && {logoAlt} }
)}
{title} { btnText && }
{description}
) // If no imgSrc and we have Link and href, wrap the entire card in a link if (!btnText && Link && href) { return ( {cardContent} ) } return cardContent }