add sub git and git-tools
This commit is contained in:
21
app/layout.tsx
Normal file
21
app/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import '@/styles/dist.css';
|
||||
import React from 'react';
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html>
|
||||
<head>
|
||||
<title>kjuulh microblog</title>
|
||||
</head>
|
||||
<body className="box-border overflow-y-scroll bg-zinc-900">
|
||||
<div className="grid grid-cols-[1fr,min(800px,100%),1fr] px-6">
|
||||
<div className="col-start-2 space-y-6">{children}</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
14
app/page.tsx
Normal file
14
app/page.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { getPosts } from '@/lib/getPosts';
|
||||
import Posts from './posts';
|
||||
|
||||
export const revalidate = 10;
|
||||
|
||||
export default async function Page() {
|
||||
const posts = await getPosts();
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Posts posts={posts} />
|
||||
</div>
|
||||
);
|
||||
}
|
5
app/postCard.tsx
Normal file
5
app/postCard.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
const PostCard = () => {
|
||||
return <div></div>;
|
||||
};
|
||||
|
||||
export default PostCard;
|
24
app/posts.tsx
Normal file
24
app/posts.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { getPosts, Post } from '@/lib/getPosts';
|
||||
import { FC, use } from 'react';
|
||||
|
||||
interface PostProps {
|
||||
posts: Post[];
|
||||
}
|
||||
const Posts: FC<PostProps> = ({ posts }) => {
|
||||
return (
|
||||
<>
|
||||
{posts.map((p) => (
|
||||
<div className="space-y-2 text-white">
|
||||
<p className="font-bold">{p.author.name}</p>
|
||||
<p>{p.title}</p>
|
||||
{p.message &&
|
||||
p.message
|
||||
.split('\n')
|
||||
.map((para, i) => para && <p key={i}>{para}</p>)}
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Posts;
|
Reference in New Issue
Block a user