var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import Avatar from '../avatar';
import ConfigProvider from '../config-provider';
import React, { Component } from 'react';
import cls from 'classnames';
import { List as NextList } from '@alifd/next';
class ListItem extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', title, media, className, avatarImg, updateTime, children } = _a, otherProps = __rest(_a, ["prefix", "title", "media", "className", "avatarImg", "updateTime", "children"]);
        if (avatarImg) {
            return (React.createElement(NextList.Item, Object.assign({ media: React.createElement(Avatar, { src: avatarImg }), title: title, className: cls(className, {
                    [`${prefix}only-content-item`]: !title && !media,
                    [`${prefix}content-avatar`]: avatarImg,
                    [`${prefix}update-time`]: updateTime,
                }) }, otherProps),
                children,
                React.createElement("div", { className: `${prefix}update-time` },
                    " ",
                    updateTime,
                    " ")));
        }
        return (React.createElement(NextList.Item, Object.assign({ media: media, title: title, className: cls(className, {
                [`${prefix}only-content-item`]: !title && !media,
                [`${prefix}only-content-img`]: media && !avatarImg,
            }) }, otherProps),
            children,
            React.createElement("div", { className: `${prefix}update-time` },
                " ",
                updateTime,
                " ")));
    }
}
class List extends Component {
    render() {
        const { prefix = 'next-', size = 'medium', className } = this.props;
        return (React.createElement(NextList, Object.assign({}, this.props, { size: size, className: cls(className, {
                [`${prefix}large`]: size === 'large',
            }) })));
    }
}
List.Item = ConfigProvider.config(ListItem);
export default ConfigProvider.config(List);
