-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from zhuba-Ahhh/dev
refactor: ♻️ 重构组件
- Loading branch information
Showing
26 changed files
with
161 additions
and
106 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,15 @@ | |
import { Link } from "next-view-transitions"; | ||
import { motion } from "framer-motion"; | ||
import { blogPosts } from "@/data/blogPosts"; | ||
import dynamic from "next/dynamic"; | ||
|
||
// 延迟加载非关键组件 | ||
const TechStack = dynamic(() => import("@/components/page/TechStack"), { | ||
ssr: false, | ||
}); | ||
const LatestPosts = dynamic(() => import("@/components/page/LatestPosts"), { | ||
ssr: false, | ||
}); | ||
|
||
export default function Home() { | ||
// 根据日期排序博客文章,并取最新的两篇 | ||
|
@@ -11,20 +20,20 @@ export default function Home() { | |
|
||
return ( | ||
<div className="flex flex-col items-center justify-center h-full text-center bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white p-4"> | ||
{/* 标题和介绍 */} | ||
{/* 标题和介绍 - 保持优先级高 */} | ||
<motion.h1 | ||
className="text-5xl font-bold mb-4" | ||
initial={{ opacity: 0, y: -50 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
transition={{ duration: 0.7, ease: "easeOut" }} | ||
transition={{ duration: 0.3, ease: "easeOut" }} | ||
> | ||
欢迎来到我的博客 | ||
</motion.h1> | ||
<motion.p | ||
className="text-lg mb-6 max-w-2xl" | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
transition={{ delay: 0.3, duration: 0.5 }} | ||
transition={{ delay: 0.1, duration: 0.3 }} | ||
> | ||
你好,我是[Zhuba-Ahhh]。作为一名前端开发者,我热衷于探索和分享Web开发的最新趋势、技巧和最佳实践。 | ||
</motion.p> | ||
|
@@ -33,7 +42,7 @@ export default function Home() { | |
<motion.div | ||
initial={{ opacity: 0, scale: 0.5 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
transition={{ delay: 0.6, duration: 0.5 }} | ||
transition={{ delay: 0.2, duration: 0.3 }} | ||
> | ||
<Link | ||
href="/blog" | ||
|
@@ -43,70 +52,18 @@ export default function Home() { | |
</Link> | ||
</motion.div> | ||
|
||
{/* 最新文章预览 */} | ||
<motion.div | ||
className="mt-12 w-full max-w-4xl" | ||
initial={{ opacity: 0, y: 50 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
transition={{ delay: 0.9, duration: 0.5 }} | ||
> | ||
<h2 className="text-3xl font-semibold mb-4">最新文章</h2> | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6"> | ||
{sortedPosts.map((post, index) => ( | ||
<Link href={`/blog/${post.id}`} key={post.id}> | ||
<motion.div | ||
className="bg-white bg-opacity-10 p-6 rounded-xl backdrop-blur-lg cursor-pointer border border-white border-opacity-20" | ||
whileHover={{ | ||
scale: 1.03, | ||
backgroundColor: "rgba(255,255,255,0.15)", | ||
}} | ||
initial={{ opacity: 0, y: 20 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
transition={{ delay: index * 0.1 }} | ||
> | ||
<h3 className="text-xl font-semibold mb-2">{post.title}</h3> | ||
<p className="text-sm opacity-80">{post.date}</p> | ||
</motion.div> | ||
</Link> | ||
))} | ||
</div> | ||
</motion.div> | ||
{/* 最新文章预览 - 延迟加载 */} | ||
<LatestPosts /> | ||
|
||
{/* 技术栈展示 */} | ||
<motion.div | ||
className="mt-12 w-full max-w-4xl" | ||
initial={{ opacity: 0, y: 50 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
transition={{ delay: 1.2, duration: 0.5 }} | ||
> | ||
<h2 className="text-3xl font-semibold mb-4">技术栈</h2> | ||
<div className="flex flex-wrap justify-center gap-4"> | ||
{["React", "Next.js", "TypeScript", "Tailwind CSS"].map( | ||
(tech, index) => ( | ||
<motion.span | ||
key={tech} | ||
className="bg-white bg-opacity-10 px-4 py-2 rounded-full text-sm font-medium" | ||
whileHover={{ | ||
scale: 1.05, | ||
backgroundColor: "rgba(255,255,255,0.2)", | ||
}} | ||
initial={{ opacity: 0, y: 20 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
transition={{ delay: index * 0.1 }} | ||
> | ||
{tech} | ||
</motion.span> | ||
) | ||
)} | ||
</div> | ||
</motion.div> | ||
{/* 技术栈展示 - 延迟加载 */} | ||
<TechStack posts={sortedPosts} /> | ||
|
||
{/* 联系方式 */} | ||
<motion.div | ||
className="mt-12 text-sm opacity-80" | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
transition={{ delay: 1.5, duration: 0.5 }} | ||
transition={{ delay: 0.3, duration: 0.3 }} | ||
> | ||
<p> | ||
联系我: [email protected] |{" "} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/components/ThemeToggle.tsx → src/components/app/ThemeToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/Comments.tsx → src/components/blog/id/Comments.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/components/ReadingProgress.tsx → src/components/blog/id/ReadingProgress.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
export * from './ui'; | ||
export * from './Comments'; | ||
export * from './Footer'; | ||
export * from './Header'; | ||
export * from './Layout'; | ||
export * from './ReadingProgress'; | ||
export * from './ThemeToggle' | ||
export * from "./ui"; | ||
export * from "./app/Layout"; | ||
export * from "./blog/id/ReadingProgress"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/components/MDXLayout.tsx → src/components/mdx/MDXLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import React from "react"; | ||
|
||
export default function MdxLayout({ children }: { children: React.ReactNode }) { | ||
return <div className="prose dark:prose-invert">{children}</div> | ||
} |
Oops, something went wrong.