Projects.js 1.55 KB
Newer Older
ζ„šι“'s avatar
ζ„šι“ committed
1
import React, { PureComponent } from 'react';
ddcat1115's avatar
ddcat1115 committed
2 3
import { List, Card } from 'antd';
import moment from 'moment';
ζ„šι“'s avatar
ζ„šι“ committed
4
import { connect } from 'dva';
ddcat1115's avatar
ddcat1115 committed
5
import AvatarList from '../../../components/AvatarList';
ζ„šι“'s avatar
ζ„šι“ committed
6
import stylesProjects from '../../List/Projects.less';
ddcat1115's avatar
ddcat1115 committed
7

ζ„šι“'s avatar
ζ„šι“ committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
@connect(({ list }) => ({
  list,
}))
export default class Center extends PureComponent {
  render() {
    const {
      list: { list },
    } = this.props;
    return (
      <List
        className={stylesProjects.coverCardList}
        rowKey="id"
        grid={{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }}
        dataSource={list}
        renderItem={item => (
          <List.Item>
            <Card
              className={stylesProjects.card}
              hoverable
              cover={<img alt={item.title} src={item.cover} />}
            >
              <Card.Meta title={<a href="#">{item.title}</a>} description={item.subDescription} />
              <div className={stylesProjects.cardItemContent}>
                <span>{moment(item.updatedAt).fromNow()}</span>
                <div className={stylesProjects.avatarList}>
                  <AvatarList size="mini">
                    {item.members.map(member => (
                      <AvatarList.Item
                        key={`${item.id}-avatar-${member.id}`}
                        src={member.avatar}
                        tips={member.name}
                      />
                    ))}
                  </AvatarList>
                </div>
ddcat1115's avatar
ddcat1115 committed
43
              </div>
ζ„šι“'s avatar
ζ„šι“ committed
44 45 46 47 48 49 50
            </Card>
          </List.Item>
        )}
      />
    );
  }
}