/*
 * compName     : 新消息通知
 * Description  :
 * Author       : 黎永顺
 * Date         : 2021-11-05 11:08:23
 * LastEditors  : 黎永顺
 * LastEditTime : 2021-11-05 14:53:04
 */

import React from 'react';
import { List, Switch } from 'antd';

type Unpacked<T> = T extends (infer U)[] ? U : T;

const Notification: React.FC = () => {
  const getData = () => {
    const Action = (
      <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked />
    );
    return [
      {
        title: '待办任务',
        description: '待办任务将以站内信的形式通知',
        actions: [Action],
      },
    ];
  };
  const data = getData();
  return (
    <>
      <List<Unpacked<typeof data>>
        itemLayout="horizontal"
        dataSource={data}
        renderItem={(item) => (
          <List.Item actions={item.actions}>
            <List.Item.Meta title={item.title} description={item.description} />
          </List.Item>
        )}
      />
    </>
  );
};

export default Notification;
