index.js 801 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
import React from 'react';
import moment from 'moment';
import marked from 'marked';
import { Avatar } from 'antd';

import styles from './index.less';

/* eslint react/no-danger:0 */
export default ({ data: { user, updatedAt, action } }) => (
  <div
    className={styles.activitiesItem}
  >
    <div className={styles.avatar}>
      {
        user.link && <a href={user.link} target="_blank">
          <Avatar src={user.avatar} />
        </a>
      }
      {
        !user.link && <img src={user.avatar} alt={user.title} />
      }
    </div>
    <div className={styles.content}>
      <div>
        <span className={styles.name}>{user.name}</span>
        <div dangerouslySetInnerHTML={{ __html: marked(action) }} />
      </div>
      <p>{moment(updatedAt).fromNow()}</p>
    </div>
  </div>
);