Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ 动效 #4

Merged
merged 3 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"analyze": "pnpm clean && ANALYZE=true next build",
"start": "next start",
"lint": "next lint",
"clean": "rm -rf .next"
"clean": "rm -rf .next",
"serve": "serve -s out -p 3010"
},
"dependencies": {
"@mdx-js/loader": "^3.0.1",
Expand All @@ -28,6 +29,7 @@
"next": "14.2.6",
"next-mdx-remote": "^5.0.0",
"next-themes": "^0.3.0",
"next-view-transitions": "^0.3.0",
"react": "^18",
"react-dom": "^18",
"react-icons": "^5.3.0",
Expand All @@ -52,4 +54,4 @@
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
}
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/app/blog/BlogClientComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ export default function BlogList() {
return (
<div className="container mx-auto px-4 py-8">
<h1 className="text-4xl font-bold mb-8 text-center">博客文章</h1>

<BlogSearch
searchTerm={searchTerm}
onSearchChange={handleSearch}
sortOption={sortOption}
onSortChange={(value: SortOption) => setSortOption(value)}
/>

<TagList
allTags={allTags}
selectedTag={selectedTag}
Expand All @@ -140,7 +140,7 @@ export default function BlogList() {
onToggleExpand={() => setIsTagsExpanded(!isTagsExpanded)}
initialTagCount={INITIAL_TAG_COUNT}
/>

<div className="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
{isLoading ? (
Array.from({ length: POSTS_PER_PAGE }).map((_, index) => (
Expand Down Expand Up @@ -187,7 +187,7 @@ export default function BlogList() {
</div>
)}
</div>

{filteredPostsMemo.length > 0 && (
<Pagination
currentPage={currentPage}
Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/BlogPostCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import { Link } from "next-view-transitions";
import { motion } from "framer-motion";
import {
Card,
Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/[id]/BlogFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import { Link } from "next-view-transitions";
import { Badge, Button } from "@/components/ui";
import { BlogPost } from "@/data/blogPosts";

Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/[id]/RelatedPosts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import { Link } from "next-view-transitions";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui";
import { BlogPost } from "@/data/blogPosts";

Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/[id]/ShareButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import { Link } from "next-view-transitions";
import { FaTwitter, FaFacebook, FaLinkedin } from "react-icons/fa";

interface ShareButtonsProps {
Expand Down
Binary file removed src/app/favicon.ico
Binary file not shown.
42 changes: 23 additions & 19 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Footer from "@/components/Footer";

import { cn } from "@/lib/utils";

import { ViewTransitions } from "next-view-transitions";

import { ThemeProvider } from "next-themes";
import AnimatedLayout from "@/components/AnimatedLayout";

Expand All @@ -22,24 +24,26 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="zh" suppressHydrationWarning className="h-full">
<link rel="icon" href="/next.svg" type="image/svg+xml" />
<body
className={cn(
`${inter.className} flex flex-col bg-background font-sans antialiased h-full`,
inter.variable
)}
>
<ThemeProvider attribute="class">
<Header />
<AnimatedLayout>
<main className="flex-grow container mx-auto px-4 h-full">
{children}
</main>
</AnimatedLayout>
<Footer />
</ThemeProvider>
</body>
</html>
<ViewTransitions>
<html lang="zh" suppressHydrationWarning className="h-full">
<link rel="icon" href="/next.svg" type="image/svg+xml" />
<body
className={cn(
`${inter.className} flex flex-col bg-background font-sans antialiased h-full`,
inter.variable
)}
>
<ThemeProvider attribute="class">
<Header />
<AnimatedLayout>
<main className="flex-grow container mx-auto px-4 h-full">
{children}
</main>
</AnimatedLayout>
<Footer />
</ThemeProvider>
</body>
</html>
</ViewTransitions>
);
}
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import Link from "next/link";
import { Link } from "next-view-transitions";
import { motion } from "framer-motion";
import { blogPosts } from "@/data/blogPosts";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import { Link } from "next-view-transitions";
import { Badge } from "@/components/ui/badge";

export default function Footer() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import Link from "next/link";
import { Link } from "next-view-transitions";
import { usePathname } from "next/navigation";
import ThemeToggle from "./ThemeToggle";
import { Button } from "@/components/ui/button";
Expand Down
3 changes: 0 additions & 3 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import animate from "tailwindcss-animate";
const config = {
darkMode: ["class"],
content: [
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./src/**/*.{ts,tsx}",
],
prefix: "",
Expand Down