home page add image
This commit is contained in:
@@ -1,16 +1,27 @@
|
|||||||
import styles from "../styles/Home.module.css";
|
import styles from "../styles/Home.module.css";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import Image from "next/image";
|
||||||
import ClickForMore from "./ClickForMore";
|
import ClickForMore from "./ClickForMore";
|
||||||
|
|
||||||
function PostPreview({ title, description, date, href }) {
|
function PostPreview({ title, description, date, href, bg }) {
|
||||||
return (
|
return (
|
||||||
<Link href={href} passHref>
|
<Link href={href} passHref>
|
||||||
<section className={styles.postPreview}>
|
<section className={styles.postPreviewWrap}>
|
||||||
<h2>{title}</h2>
|
<div className={styles.postPreview}>
|
||||||
<p>{description}</p>
|
<h2>{title}</h2>
|
||||||
<small>发布于 {date}</small>
|
<p>{description}</p>
|
||||||
{" | "}
|
<small>发布于 {date}</small>
|
||||||
<ClickForMore />
|
{" | "}
|
||||||
|
<ClickForMore />
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: "39%",
|
||||||
|
maxWidth: "20rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{bg && <Image src={bg} />}
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import mainbg from "../public/mainbg.webp";
|
|||||||
// styles
|
// styles
|
||||||
import styles from "../styles/Home.module.css";
|
import styles from "../styles/Home.module.css";
|
||||||
|
|
||||||
|
import bg486 from "../public/486.webp";
|
||||||
|
import bgmap from "../public/typhoon.png";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -31,6 +34,7 @@ export default function Home() {
|
|||||||
title="社会管理法律"
|
title="社会管理法律"
|
||||||
description="小组研讨真实法律案件的案情和判决"
|
description="小组研讨真实法律案件的案情和判决"
|
||||||
date="2022-07-06"
|
date="2022-07-06"
|
||||||
|
bg={bg486}
|
||||||
/>
|
/>
|
||||||
<hr />
|
<hr />
|
||||||
<PostPreview
|
<PostPreview
|
||||||
@@ -38,6 +42,7 @@ export default function Home() {
|
|||||||
title="全国灾害统计地图"
|
title="全国灾害统计地图"
|
||||||
description=""
|
description=""
|
||||||
date="2022-05-12"
|
date="2022-05-12"
|
||||||
|
bg={bgmap}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,5 +7,12 @@
|
|||||||
.postPreview {
|
.postPreview {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postPreviewWrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user