Add blog overview page (/blog), link Navbar "Blog" to it
- app/blog/page.tsx: header (title/subheading + bleeding photo with a left-edge fade, per Figma node 4577:330), featured-post card (most recent), remaining posts as a divided list with category/readTime/date, and the reusable Newsletter signup panel. Uses all real posts from Payload — the Figma mockup padded its list out to 4 items with two posts that were never actually seeded, so this only renders what exists (currently 1 featured + 2 listed). - lib/payload.ts: BlogPost now carries publishedAt (needed for the list's per-post date), removed the now-redundant duplicate field on PostDetail. - Navbar: "Blog" now links to /blog instead of scrolling to the homepage's #blog anchor — same real-route pattern as "Shop". - blog/[slug]/page.tsx: earlier title-size tuning (fluid clamp between text-h-feature and text-display) from this session's follow-up feedback, not yet pushed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -9,6 +9,7 @@ export type BlogPost = {
|
||||
readTime: number;
|
||||
excerpt: string;
|
||||
thumbnail: string | null;
|
||||
publishedAt: string;
|
||||
};
|
||||
|
||||
type PayloadPost = {
|
||||
@@ -19,6 +20,7 @@ type PayloadPost = {
|
||||
readTime: number;
|
||||
excerpt: string;
|
||||
thumbnail: { url: string } | number | null;
|
||||
publishedAt: string;
|
||||
};
|
||||
|
||||
export async function getBlogPosts(limit = 3): Promise<BlogPost[]> {
|
||||
@@ -53,15 +55,15 @@ export async function getBlogPosts(limit = 3): Promise<BlogPost[]> {
|
||||
typeof post.thumbnail === "object" && post.thumbnail
|
||||
? post.thumbnail.url
|
||||
: null,
|
||||
publishedAt: post.publishedAt,
|
||||
}));
|
||||
}
|
||||
|
||||
export type PostDetail = BlogPost & {
|
||||
content: unknown;
|
||||
publishedAt: string;
|
||||
};
|
||||
|
||||
type PayloadPostDetail = PayloadPost & { content: unknown; publishedAt: string };
|
||||
type PayloadPostDetail = PayloadPost & { content: unknown };
|
||||
|
||||
export async function getPostBySlug(slug: string): Promise<PostDetail | null> {
|
||||
const params = new URLSearchParams({
|
||||
|
||||
Reference in New Issue
Block a user