feat: add homepage and contacts(to-do)

This commit is contained in:
2024-12-17 01:48:47 +08:00
parent 35611e2d34
commit 987b8f04f3
7 changed files with 143 additions and 93 deletions
+34
View File
@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}
+31
View File
@@ -0,0 +1,31 @@
import Link from "next/link";
import { contacts } from "../../data/contacts";
export default function Contacts() {
return (
<div className="min-h-screen flex flex-col bg-gray-50">
<header className="w-full bg-white shadow p-4 flex justify-between items-center">
<h1 className="text-2xl font-bold text-gray-900">联系人信息</h1>
<nav>
<Link href="/" className="text-blue-600 hover:underline">返回主页</Link>
</nav>
</header>
<main className="container mx-auto p-4 flex-grow">
<section className="text-center mb-12">
<h2 className="text-4xl font-extrabold text-gray-900">我们的联系人</h2>
<p className="text-xl text-gray-600 mt-4">以下是我们的联系人的信息,您可以通过点击邮箱链接发送邮件。</p>
</section>
<section className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
{contacts.map((contact, index) => (
<div key={index} className="bg-white shadow rounded-lg p-6 text-center">
<h3 className="text-xl font-semibold text-gray-900">{contact.name}</h3>
<p className="text-gray-600 mt-2">
<a href={`mailto:${contact.email}`} className="text-blue-600 hover:underline">{contact.email}</a>
</p>
</div>
))}
</section>
</main>
</div>
);
}
+21 -91
View File
@@ -1,101 +1,31 @@
import Image from "next/image"; import Image from "next/image";
import { websites } from "../data/urls";
import Header from "@/components/header";
import Footer from "@/components/footer";
export default function Home() { export default function Home() {
return ( return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]"> <div className="min-h-screen flex flex-col bg-gray-50">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start"> <Header />
<Image <main className="container mx-auto p-4 flex-grow">
className="dark:invert" <section className="text-center mb-12">
src="/next.svg" <h2 className="text-4xl font-extrabold text-gray-900">实验室简介</h2>
alt="Next.js logo" <p className="text-xl text-gray-600 mt-4">这里是实验室的基本信息简介,简洁明了地介绍实验室。</p>
width={180} </section>
height={38} <section className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
priority {websites.map((website, index) => (
/> <div key={index} className="bg-white shadow rounded-lg p-6 text-center">
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]"> <Image src={website.icon} alt={`${website.title}图标`} width={64} height={64} className="mx-auto mb-4" />
<li className="mb-2"> <h3 className="text-xl font-semibold text-gray-900">{website.title}</h3>
Get started by editing{" "} <p className="text-gray-600 mt-2">{website.description}</p>
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold"> <a href={website.link} className="text-blue-600 hover:underline mt-4 block">
app/page.tsx 访问{website.title}
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>
<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a> </a>
</div> </div>
))}
</section>
</main> </main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> <Footer />
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org →
</a>
</footer>
</div> </div>
); );
} }
+7
View File
@@ -0,0 +1,7 @@
export default function Footer() {
return (
<footer className="w-full bg-white shadow p-4 text-left text-gray-500">
<p>© {new Date().getFullYear()} 智能计算实验室</p>
</footer>
);
}
+12
View File
@@ -0,0 +1,12 @@
import Link from "next/link";
export default function Header() {
return (
<header className="w-full bg-white shadow p-4 flex justify-between items-center">
<h1 className="text-2xl font-bold text-gray-900">智能计算实验室</h1>
<nav>
<Link href="/contacts" className="text-blue-600 hover:underline">联系人</Link>
</nav>
</header>
);
}
+14
View File
@@ -0,0 +1,14 @@
export const contacts = [
{
name: "张三",
email: "zhangsan@example.com"
},
{
name: "李四",
email: "lisi@example.com"
},
{
name: "王五",
email: "wangwu@example.com"
}
];
+22
View File
@@ -0,0 +1,22 @@
// data/websites.ts
export const websites = [
{
icon: "/path/to/icon1.png",
title: "实验室网站1",
description: "网站1的简介。",
link: "https://website1.example.com",
},
{
icon: "/path/to/icon2.png",
title: "实验室网站2",
description: "网站2的简介。",
link: "https://website2.example.com",
},
{
icon: "/path/to/icon3.png",
title: "实验室网站3",
description: "网站3的简介。",
link: "https://website3.example.com",
},
// 添加更多网站数据
];