Applications.js 2.26 KB
Newer Older
ddcat1115's avatar
ddcat1115 committed
1 2 3 4
import React from 'react';
import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd';
import numeral from 'numeral';
import { formatWan } from '../../../utils/utils';
xiaohu's avatar
xiaohu committed
5
import stylesApplications from '../../List/Search/Applications.less';
ddcat1115's avatar
ddcat1115 committed
6

jim's avatar
jim committed
7
export default props => {
ddcat1115's avatar
ddcat1115 committed
8 9 10 11
  const { list } = props;
  const itemMenu = (
    <Menu>
      <Menu.Item>
jim's avatar
jim committed
12 13 14
        <a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">
          1st menu item
        </a>
ddcat1115's avatar
ddcat1115 committed
15 16
      </Menu.Item>
      <Menu.Item>
jim's avatar
jim committed
17 18 19
        <a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">
          2nd menu item
        </a>
ddcat1115's avatar
ddcat1115 committed
20 21
      </Menu.Item>
      <Menu.Item>
jim's avatar
jim committed
22 23 24
        <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
          3d menu item
        </a>
ddcat1115's avatar
ddcat1115 committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
      </Menu.Item>
    </Menu>
  );
  const CardInfo = ({ activeUser, newUser }) => (
    <div className={stylesApplications.cardInfo}>
      <div>
        <p>活跃用户</p>
        <p>{activeUser}</p>
      </div>
      <div>
        <p>新增用户</p>
        <p>{newUser}</p>
      </div>
    </div>
  );
  return (
    <List
      rowKey="id"
      className={stylesApplications.filterCardList}
      grid={{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }}
      dataSource={list}
      renderItem={item => (
        <List.Item key={item.id}>
          <Card
            hoverable
            bodyStyle={{ paddingBottom: 20 }}
            actions={[
jim's avatar
jim committed
52 53 54 55 56 57 58 59 60 61 62 63
              <Tooltip title="下载">
                <Icon type="download" />
              </Tooltip>,
              <Tooltip title="编辑">
                <Icon type="edit" />
              </Tooltip>,
              <Tooltip title="分享">
                <Icon type="share-alt" />
              </Tooltip>,
              <Dropdown overlay={itemMenu}>
                <Icon type="ellipsis" />
              </Dropdown>,
ddcat1115's avatar
ddcat1115 committed
64 65
            ]}
          >
jim's avatar
jim committed
66
            <Card.Meta avatar={<Avatar size="small" src={item.avatar} />} title={item.title} />
ddcat1115's avatar
ddcat1115 committed
67 68 69 70 71 72 73 74 75 76 77 78
            <div className={stylesApplications.cardItemContent}>
              <CardInfo
                activeUser={formatWan(item.activeUser)}
                newUser={numeral(item.newUser).format('0,0')}
              />
            </div>
          </Card>
        </List.Item>
      )}
    />
  );
};