move to PostPreview.js component
This commit is contained in:
19
components/PostPreview.js
Normal file
19
components/PostPreview.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import styles from "../styles/Home.module.css";
|
||||||
|
import Link from "next/link";
|
||||||
|
import ClickForMore from "./ClickForMore";
|
||||||
|
|
||||||
|
function PostPreview({ title, description, date, href }) {
|
||||||
|
return (
|
||||||
|
<Link href={href} passHref>
|
||||||
|
<section className={styles.postPreview}>
|
||||||
|
<h2>{title}</h2>
|
||||||
|
<p>{description}</p>
|
||||||
|
<small>发布于 {date}</small>
|
||||||
|
{" | "}
|
||||||
|
<ClickForMore />
|
||||||
|
</section>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PostPreview;
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Link from "next/link";
|
|
||||||
import Header from "../components/Header";
|
import Header from "../components/Header";
|
||||||
import ClickForMore from "../components/ClickForMore";
|
import PostPreview from "../components/PostPreview";
|
||||||
|
|
||||||
import mainbg from "../public/mainbg.webp";
|
import mainbg from "../public/mainbg.webp";
|
||||||
|
|
||||||
@@ -20,30 +19,27 @@ export default function Home() {
|
|||||||
<Header propBG={mainbg}></Header>
|
<Header propBG={mainbg}></Header>
|
||||||
|
|
||||||
<main className={styles.container}>
|
<main className={styles.container}>
|
||||||
<Link href="/posts/init" passHref>
|
<PostPreview
|
||||||
<section className={styles.postPreview}>
|
href="/posts/init"
|
||||||
<h2>Social OjO 正式成立</h2>
|
title="Social OjO 正式成立"
|
||||||
<p>平台介绍、期望及使命</p>
|
description="平台介绍、期望及使命"
|
||||||
<small>发布于 2022-05-12</small>{" | "}<ClickForMore />
|
date="2022-05-12"
|
||||||
</section>
|
/>
|
||||||
</Link>
|
|
||||||
<hr />
|
<hr />
|
||||||
<Link href="/posts/law" passHref>
|
<PostPreview
|
||||||
<section className={styles.postPreview}>
|
href="/posts/law"
|
||||||
<h2>社会管理法律</h2>
|
title="社会管理法律"
|
||||||
<p>小组研讨真实法律案件的案情和判决</p>
|
description="小组研讨真实法律案件的案情和判决"
|
||||||
<small>发布于 2022-07-06</small>{" | "}<ClickForMore />
|
date="2022-07-06"
|
||||||
</section>
|
/>
|
||||||
</Link>
|
|
||||||
<hr />
|
<hr />
|
||||||
<Link href="/posts/map" passHref>
|
<PostPreview
|
||||||
<section className={styles.postPreview}>
|
href="/posts/map"
|
||||||
<h2>全国灾害统计地图</h2>
|
title="全国灾害统计地图"
|
||||||
<small>发布于 2022-05-12</small>{" | "}<ClickForMore />
|
description=""
|
||||||
</section>
|
date="2022-05-12"
|
||||||
</Link>
|
/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user