Fakultas Ilmu Komputer UI

PreviewThread.jsx 823 Bytes
Newer Older
FadhilP's avatar
FadhilP committed
1
2
import '../../styles/thread/PreviewThread.css';
import { translate } from '../../helpers/time-util';
FadhilP's avatar
FadhilP committed
3
import { Link } from 'react-router-dom';
4

FadhilP's avatar
FadhilP committed
5
export default function PreviewThread(props) {
FadhilP's avatar
FadhilP committed
6
7
8
9
10
11
12
13
14
15
16
17
  const { content } = props;
  const time = translate(content.inserted_at);
  return (
    <div id="threadCard">
      <div id="threadCardHeader">
        <h2 id="judul">
          <b>{content.title}</b>
        </h2>
      </div>
      <p id="topic">{content.topic_name}</p>
      <div id="threadCardContent">
        <p>
FadhilP's avatar
FadhilP committed
18
          By{' '}
FadhilP's avatar
FadhilP committed
19
          <Link to={`/profile/${content.username}/1`}>{content.username}</Link>{' '}
Jonathan Chandra's avatar
Jonathan Chandra committed
20
21
22
23
24
          {', '}
          {window.innerWidth < 780 && (
            <br></br>
          )}
          {time} - <i className="far fa-thumbs-up" /> {content.points}
FadhilP's avatar
FadhilP committed
25
26
27
28
        </p>
      </div>
    </div>
  );
FadhilP's avatar
FadhilP committed
29
}