post.tsx 784 Bytes
Newer Older
1
import React, { MouseEventHandler } from "react";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { Link } from "react-router-dom";
3
import { PostType } from "../types";
Lee Soobeom's avatar
Lee Soobeom committed
4
import { IntoPost } from "./intopost";
5

Lee Soobeom's avatar
Lee Soobeom committed
6
export type Props = {
7
8
9
  post: PostType;
  handleClick: MouseEventHandler;
};
Lee Soobeom's avatar
Lee Soobeom committed
10

11
12
13
export default function Post({ handleClick, post }: Props) {
  return (
    <div className="flex flex-row h-16 divide-x-2 border-2 border-solid">
Lee Soobeom's avatar
수정    
Lee Soobeom committed
14
      <div className="basis-full truncate">
Lee Soobeom's avatar
Lee Soobeom committed
15
        <button id={post._id} onClick={handleClick}>
Lee Soobeom's avatar
post    
Lee Soobeom committed
16
          <Link to={`${post._id}`} state={post}>
Lee Soobeom's avatar
Lee Soobeom committed
17
            {post.title}
Lee Soobeom's avatar
Lee Soobeom committed
18
19
          </Link>
        </button>
20
      </div>
Lee Soobeom's avatar
수정    
Lee Soobeom committed
21
22
23
24
      <div className="basis-3/12 text-xs md:text-lg">
        {post.date.slice(0, 10)}
      </div>
      <div className="basis-3/12">{post.counts}</div>
25
26
27
    </div>
  );
}