import * as React from 'react'; import classNames from 'classnames'; import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; export interface CardMetaProps { prefixCls?: string; style?: React.CSSProperties; className?: string; avatar?: React.ReactNode; title?: React.ReactNode; description?: React.ReactNode; } const Meta: React.SFC = props => ( {({ getPrefixCls }: ConfigConsumerProps) => { const { prefixCls: customizePrefixCls, className, avatar, title, description, ...others } = props; const prefixCls = getPrefixCls('card', customizePrefixCls); const classString = classNames(`${prefixCls}-meta`, className); const avatarDom = avatar ?
{avatar}
: null; const titleDom = title ?
{title}
: null; const descriptionDom = description ? (
{description}
) : null; const MetaDetail = titleDom || descriptionDom ? (
{titleDom} {descriptionDom}
) : null; return (
{avatarDom} {MetaDetail}
); }}
); export default Meta;