-
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 #2 from zhuba-Ahhh/dev
feat: ✨ framer-motion
- Loading branch information
Showing
11 changed files
with
255 additions
and
116 deletions.
There are no files selected for viewing
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,33 +1,34 @@ | ||
import createMDX from '@next/mdx' | ||
import bundleAnalyzer from '@next/bundle-analyzer' | ||
import createMDX from "@next/mdx"; | ||
import bundleAnalyzer from "@next/bundle-analyzer"; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
output: 'export', | ||
output: "export", | ||
reactStrictMode: true, | ||
compress: true, | ||
poweredByHeader: false, | ||
optimizeFonts: true, | ||
swcMinify: true, | ||
images: { | ||
unoptimized: true | ||
unoptimized: true, | ||
}, | ||
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], | ||
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"], | ||
webpack: (config, { isServer }) => { | ||
if (!isServer) { | ||
config.externals = { | ||
// 添加其他需要从 CDN 加载的依赖 | ||
} | ||
}; | ||
} | ||
return config | ||
return config; | ||
}, | ||
// experimental: { turbo: {} }, | ||
}; | ||
|
||
const withMDX = createMDX({}) | ||
const withMDX = createMDX({}); | ||
|
||
// 修改 bundle-analyzer 配置 | ||
const withBundleAnalyzer = bundleAnalyzer({ | ||
enabled: process.env.ANALYZE === 'true', | ||
}) | ||
enabled: process.env.ANALYZE === "true", | ||
}); | ||
|
||
export default withBundleAnalyzer(withMDX(nextConfig)); | ||
export default withBundleAnalyzer(withMDX(nextConfig)); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use client'; | ||
|
||
import { motion } from 'framer-motion'; | ||
import BlogHeader from "./BlogHeader"; | ||
import BlogContent from "./BlogContent"; | ||
import BlogFooter from "./BlogFooter"; | ||
import RelatedPosts from "./RelatedPosts"; | ||
import ShareButtons from "./ShareButtons"; | ||
import TableOfContents from "./TableOfContents"; | ||
import Comments from "@/components/Comments"; | ||
import { mdxComponents } from "./MdxComponents"; | ||
import type { BlogPost, Heading } from "./types"; | ||
|
||
interface AnimatedBlogPostProps { | ||
post: BlogPost; | ||
headings: Heading[]; | ||
readingTime: number; | ||
relatedPosts: BlogPost[]; | ||
} | ||
|
||
export default function AnimatedBlogPost({ post, headings, readingTime, relatedPosts }: AnimatedBlogPostProps) { | ||
return ( | ||
<motion.div | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
transition={{ duration: 0.5 }} | ||
className="container mx-auto px-4 py-8" | ||
> | ||
<div className="flex flex-col md:flex-row gap-8"> | ||
<aside className="md:w-1/4"> | ||
<motion.div | ||
initial={{ x: -50, opacity: 0 }} | ||
animate={{ x: 0, opacity: 1 }} | ||
transition={{ duration: 0.5, delay: 0.2 }} | ||
> | ||
<TableOfContents headings={headings} /> | ||
</motion.div> | ||
</aside> | ||
<motion.article | ||
className="md:w-3/4" | ||
initial={{ y: 50, opacity: 0 }} | ||
animate={{ y: 0, opacity: 1 }} | ||
transition={{ duration: 0.5, delay: 0.3 }} | ||
> | ||
<BlogHeader post={post} readingTime={readingTime} /> | ||
<BlogContent content={post.content} components={mdxComponents} /> | ||
<BlogFooter post={post} /> | ||
<RelatedPosts posts={relatedPosts} /> | ||
<ShareButtons | ||
url={`https://yourblog.com/blog/${post.id}`} | ||
title={post.title} | ||
/> | ||
<div className="mt-16"> | ||
<Comments /> | ||
</div> | ||
</motion.article> | ||
</div> | ||
</motion.div> | ||
); | ||
} |
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
Oops, something went wrong.