import { Avatar, List } from 'antd';
import React from 'react';
import classNames from 'classnames';
import styles from './NoticeList.less';
const NoticeList = ({
list = [],
onClick,
onClear,
title,
onViewMore,
emptyText,
showClear = true,
clearText,
viewMoreText,
showViewMore = false,
}) => {
if (!list || list.length === 0) {
return (
{emptyText}
);
}
return (
{
const itemCls = classNames(styles.item, {
[styles.read]: item.read,
}); // eslint-disable-next-line no-nested-ternary
const leftIcon = item.avatar ? (
typeof item.avatar === 'string' ? (
) : (
{item.avatar}
)
) : null;
return (
{
onClick?.(item);
}}
>
{item.title}
{item.extra}
}
description={
{item.description}
{item.datetime}
}
/>
);
}}
/>
{showClear ? (
{clearText} {title}
) : null}
{showViewMore ? (
{
if (onViewMore) {
onViewMore(e);
}
}}
>
{viewMoreText}
) : null}
);
};
export default NoticeList;