summaryrefslogtreecommitdiff
path: root/src/components/sections
diff options
context:
space:
mode:
authorBertrand Yuan <bert.yuan@outlook.com>2025-12-16 00:25:04 +0800
committerGitHub <noreply@github.com>2025-12-16 00:25:04 +0800
commit39c83fbb69ef06d2d56790d75abc254ba7e34394 (patch)
treedd006593448c3500bdcb414af3b4656f7a7683d4 /src/components/sections
parent48b07bc308a35734a6a7a305c8fdccbfa47de7d8 (diff)
parent785371bb3eccca455e5ce5fccbe9b6e3752a03f6 (diff)
Merge pull request #1 from bertyuan/feat-introduce-payloadv1.0
Feat: introduce payload
Diffstat (limited to 'src/components/sections')
-rw-r--r--src/components/sections/footer.tsx32
-rw-r--r--src/components/sections/header/menu.tsx2
-rw-r--r--src/components/sections/header/navbar.tsx2
3 files changed, 13 insertions, 23 deletions
diff --git a/src/components/sections/footer.tsx b/src/components/sections/footer.tsx
index 8d0d876..a982810 100644
--- a/src/components/sections/footer.tsx
+++ b/src/components/sections/footer.tsx
@@ -1,18 +1,19 @@
-import { baseOptions, linkItems, postsPerPage } from '@/app/layout.config';
+import { baseOptions, linkItems, postsPerPage } from '@/app/(main)/layout.config';
import { InlineLink } from '@/components/inline-link';
-import { getSortedByDatePosts, getTags } from '@/lib/source';
+import { getPublishedPosts, getAllTags } from '@/lib/payload-posts';
import { cn } from '@/lib/utils';
import { getLinks } from 'fumadocs-ui/layouts/shared';
import { ActiveLink } from '../active-link';
-export function Footer() {
+export async function Footer() {
const links = getLinks(linkItems, baseOptions.githubUrl);
const navItems = links.filter((item) =>
['nav', 'all'].includes(item.on ?? 'all'),
);
- const posts = getSortedByDatePosts();
- const tags = getTags();
+ // 从 Payload 获取文章和标签
+ const { posts } = await getPublishedPosts({ limit: postsPerPage });
+ const tags = await getAllTags();
return (
<footer className={cn('flex flex-col gap-4')}>
@@ -54,7 +55,7 @@ export function Footer() {
{posts.slice(0, postsPerPage).map((post, i) => (
<li key={post.url}>
<ActiveLink key={i.toString()} href={post.url}>
- {post.data.title}
+ {post.title}
</ActiveLink>
</li>
))}
@@ -65,10 +66,10 @@ export function Footer() {
<p className='font-medium text-foreground'>Tags</p>
<ul className='flex flex-col gap-3'>
- {tags.slice(0, postsPerPage).map((name, i) => (
- <li key={`/tags/${name}`}>
- <ActiveLink key={i.toString()} href={`/tags/${name}`}>
- <span className='capitalize'>{name}</span>
+ {tags.slice(0, postsPerPage).map((item, i) => (
+ <li key={`/tags/${item.tag}`}>
+ <ActiveLink key={i.toString()} href={`/tags/${item.tag}`}>
+ <span className='capitalize'>{item.tag}</span>
</ActiveLink>
</li>
))}
@@ -96,17 +97,6 @@ export function Footer() {
</ul>
</div>
</div>
- {/* <Design /> */}
</footer>
);
}
-
-function Design() {
- return (
- <div className='footer'>
- <span className='footer-text font-mono'>john•doe</span>
- <div className='footer-grid' />
- <div className='footer-gradient' />
- </div>
- );
-}
diff --git a/src/components/sections/header/menu.tsx b/src/components/sections/header/menu.tsx
index 57ddf12..7eb6644 100644
--- a/src/components/sections/header/menu.tsx
+++ b/src/components/sections/header/menu.tsx
@@ -2,7 +2,7 @@
import { cva } from 'class-variance-authority';
import Link from 'fumadocs-core/link';
-import { cn } from 'fumadocs-ui/components/api';
+import { cn } from '@/lib/utils';
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
import {
NavigationMenuContent,
diff --git a/src/components/sections/header/navbar.tsx b/src/components/sections/header/navbar.tsx
index 25850a0..bac7d3d 100644
--- a/src/components/sections/header/navbar.tsx
+++ b/src/components/sections/header/navbar.tsx
@@ -1,7 +1,7 @@
'use client';
import Link, { type LinkProps } from 'fumadocs-core/link';
-import { cn } from 'fumadocs-ui/components/api';
+import { cn } from '@/lib/utils';
import {
NavigationMenu,
NavigationMenuLink,