import React, { ReactElement } from "react"; import PropTypes from "prop-types"; import { isEmpty, isNil } from "lodash"; interface ICardProps { orientation: string; imageUrl?: string; hasDetails?: boolean; title?: React.ReactNode; children?: React.ReactNode; borderColorClass?: string; backgroundColor?: string; cardState?: "wanted" | "delete" | "scraped" | "uncompressed" | "imported" | "missing"; onClick?: (event: React.MouseEvent) => void; cardContainerStyle?: React.CSSProperties; imageStyle?: React.CSSProperties; } const getCardStateClass = (cardState?: string): string => { switch (cardState) { case "wanted": return "bg-card-wanted"; case "delete": return "bg-card-delete"; case "scraped": return "bg-card-scraped"; case "uncompressed": return "bg-card-uncompressed"; case "imported": return "bg-card-imported"; case "missing": return "bg-card-missing"; default: return ""; } }; const renderCard = (props: ICardProps): ReactElement => { switch (props.orientation) { case "horizontal": return (
Placeholder image
{props.hasDetails && (
{props.children}
)}
); case "vertical": return (
Placeholder image
{props.hasDetails && (
{!isNil(props.title) ? (
{props.title}
) : null} {props.children}
)}
); case "vertical-2": return (
{props.imageUrl ? ( Home ) : (
)} {props.cardState === "missing" && (
)}
{props.title ? (
{props.title}
) : null} {props.hasDetails ? (
<>{props.children}
) : null}
); case "horizontal-small": return ( <>
{/* thumbnail */}
{/* details */}

{props.title}

); case "horizontal-medium": return ( <>
{/* thumbnail */}
{/* details */}

{props.title}

{props.hasDetails && <>{props.children}}
); case "cover-only": return ( <> {/* thumbnail */}
); case "card-with-info-panel": return ( <>
{/* thumbnail */}
{/* myata-dyata */}
); default: return <>; } }; export const Card = React.memo( (props: ICardProps): ReactElement => renderCard(props), ); export default Card;