Projects.js 1.54 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';
5
import AvatarList from '@/components/AvatarList';
ζ„šι“'s avatar
ζ„šι“ committed
6
import stylesProjects from '../../List/Projects.less';
ddcat1115's avatar
ddcat1115 committed
7

afc163's avatar
afc163 committed
8
export default
ζ„šι“'s avatar
ζ„šι“ committed
9 10 11
@connect(({ list }) => ({
  list,
}))
afc163's avatar
afc163 committed
12
class Center extends PureComponent {
ζ„šι“'s avatar
ζ„šι“ committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  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} />}
            >
30
              <Card.Meta title={<a>{item.title}</a>} description={item.subDescription} />
ζ„šι“'s avatar
ζ„šι“ committed
31 32 33 34 35 36 37 38 39 40 41 42 43
              <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
44
              </div>
ζ„šι“'s avatar
ζ„šι“ committed
45 46 47 48 49 50 51
            </Card>
          </List.Item>
        )}
      />
    );
  }
}