import React from 'react';
import classNames from 'classnames';
import Icon from '../icon';
export interface ListItemProps {
className?: string;
children?: React.ReactNode;
prefixCls?: string;
style?: React.CSSProperties;
extra: React.ReactNode;
Meta: React.ReactNode;
Content: React.ReactNode;
Action: React.ReactNode;
}
export interface ListItemMetaProps {
avatar?: React.ReactNode;
className?: string;
children?: React.ReactNode;
description: React.ReactNode;
prefixCls?: string;
style?: React.CSSProperties;
title: React.ReactNode;
}
export interface ListItemContentProps {
className?: string;
children?: React.ReactNode;
prefixCls?: string;
style?: React.CSSProperties;
}
export interface ListItemActionProps {
actions: any[];
className?: string;
children?: React.ReactNode;
prefixCls?: string;
style?: React.CSSProperties;
}
export const Meta = (props: ListItemMetaProps) => {
const {
prefixCls = 'ant-list',
className,
avatar,
title,
description,
...others,
} = props;
const classString = classNames(`${prefixCls}-item-meta`, className);
const content = (
{title &&
{title}
}
{description &&
{description}
}
);
return (
{avatar &&
{avatar}
}
{(title || description) && content}
);
};
export const Content = (props: ListItemContentProps) => {
const { prefixCls = 'ant-list', children, className, ...others } = props;
const classString = classNames(`${prefixCls}-item-content`, className);
return (
{children}
);
};
export const Action = (props: ListItemActionProps) => {
const { prefixCls = 'ant-list', children, actions, className, ...others } = props;
const classString = classNames(`${prefixCls}-item-action`, className);
const actionsContent = actions && actions.map((action, i) => (
{})}
>
{action.icon && }
{action.text}
{i !== (actions.length - 1) && }
));
return (
{actions ? actionsContent : children}
);
};
export default class Item extends React.Component {
static Meta: typeof Meta = Meta;
static Content: typeof Content = Content;
static Action: typeof Action = Action;
render() {
const { prefixCls = 'ant-list', children, extra, className, ...others } = this.props;
const classString = classNames(`${prefixCls}-item`, className);
const extraContent = ;
return (
{extra ? extraContent : children}
);
}
}