post.tsx 620 Bytes
Newer Older
1
import React, { useState } from "react";
Lee Soobeom's avatar
Lee Soobeom committed
2
import { PostType } from "./typesrc";
3
4
5
6
7
8
9
10
11
12
13

type Props = {
    post: PostType;
}

export default function Post({ post }: Props) {
    const [count, setCount] = useState(0);

    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
                <button id={post.id} onClick={() => setCount(count + 1)}>{post.title}</button>
15
16
17
18
19
20
            </div> {/*<Link to>title</Link> */}
            <div className="basis-3/12">{post.date}</div>
            <div className="basis-2/12">{count}</div>
        </div>
    );
}