post.tsx 620 Bytes
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
import React, { useState, MouseEvent, MouseEventHandler } from "react";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { PostType } from "./typesrc";
3
4
5

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

Lee Soobeom's avatar
Lee Soobeom committed
9
export default function Post({ handleClick, post }: Props) {
Lee Soobeom's avatar
Lee Soobeom committed
10

11
12
13
    return (
        <div className="flex flex-row h-16 divide-x-2 border-2 border-solid">
            <div className="basis-full">
Lee Soobeom's avatar
Lee Soobeom committed
14
15
                <button id={post.id} onClick={handleClick}>{post.title}</button>
            </div>
16
            <div className="basis-3/12">{post.date}</div>
Lee Soobeom's avatar
Lee Soobeom committed
17
            <div className="basis-2/12">{post.counts}</div>
18
19
20
        </div>
    );
}