import React, { FC, ImgHTMLAttributes, ReactNode } from 'react'; import Card, { CardProps } from '../Card/Card'; import Caption from '../Typography/Caption/Caption'; import Title from '../Typography/Title/Title'; import Text from '../Typography/Text/Text'; import Tappable from '../Tappable/Tappable'; import { classNames } from '../../lib/classNames'; import { getClassName } from '../../helpers/getClassName'; import { usePlatform } from '../../hooks/usePlatform'; import { hasReactNode } from '../../lib/utils'; import { HasRef, HasRootRef } from '../../types'; export interface ContentCardProps extends HasRootRef, ImgHTMLAttributes, HasRef{ /** Текст над заголовком */ subtitle?: ReactNode; /** Заголовок */ header?: ReactNode; /** Текст */ text?: ReactNode; /** Нижний текст */ caption?: ReactNode; /** URL или путь к изображению */ image?: string; /** Максимальная высота изображения */ maxHeight?: number; /** Аналогично alt для img */ alt?: string; /** Отключает Tappable у карточки */ disabled?: boolean; /** В точности как у `` */ mode?: CardProps['mode']; } const ContentCard: FC = (props) => { const { getRef, onClick, subtitle, header, text, caption, className, image, disabled, mode, alt, style, getRootRef, ...restProps } = props; const platform = usePlatform(); return ( {image && } {hasReactNode(subtitle) && {subtitle}} {hasReactNode(header) && {header}} {hasReactNode(text) && {text}} {hasReactNode(caption) && {caption}} ); }; ContentCard.defaultProps = { mode: 'shadow', }; export default ContentCard;