Skip to content

Commit 3437529

Browse files
committed
next.js 15 and tailwind 4 support
1 parent 1e14589 commit 3437529

29 files changed

+2309
-2859
lines changed

.eslintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/*
1+
22

.prettierrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ module.exports = {
44
singleQuote: true,
55
bracketSpacing: false,
66
semi: false,
7-
trailingComma: 'none'
7+
trailingComma: 'none',
8+
plugins: ['prettier-plugin-tailwindcss']
89
}

.stylelintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.stylelintrc.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"EditorConfig.EditorConfig",
44
"GraphQL.vscode-graphql-syntax",
55
"dbaeumer.vscode-eslint",
6-
"esbenp.prettier-vscode",
7-
"stylelint.vscode-stylelint"
6+
"esbenp.prettier-vscode"
87
]
98
}

app/[slug]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import getAllBooks from '@/lib/queries/getAllBooks'
22
import getAllPosts from '@/lib/queries/getAllPosts'
33
import getPageBySlug from '@/lib/queries/getPageBySlug'
4+
import type {DynamicPageProps} from '@/lib/types'
45
import {Page, Post} from '@/lib/types'
56
import Image from 'next/image'
67
import Link from 'next/link'
@@ -83,9 +84,9 @@ function RenderPostsList({posts, context}: {posts: Post[]; context: string}) {
8384
/**
8485
* Catch-all Archive Page route.
8586
*/
86-
export default async function Archive({params}: {params: {slug: string}}) {
87+
export default async function Archive({params}: DynamicPageProps) {
8788
// Get the slug from the params.
88-
const {slug} = params
89+
const {slug} = await params
8990

9091
// Fetch data from WordPress.
9192
const data = await fetchData(slug)

app/api/revalidate/route.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import {revalidatePath, revalidateTag} from 'next/cache'
22
import {NextRequest} from 'next/server'
33

4-
/**
5-
* Route segment configuration.
6-
*/
7-
export const runtime = 'edge'
8-
94
/**
105
* On-demand revalidation.
116
*

app/blog/[slug]/page.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import CommentForm from '@/components/CommentForm'
22
import getAllPosts from '@/lib/queries/getAllPosts'
33
import getPostBySlug from '@/lib/queries/getPostBySlug'
4+
import type {DynamicPageProps} from '@/lib/types'
45
import {Metadata} from 'next'
6+
import Image from 'next/image'
57
import Link from 'next/link'
68
import {notFound} from 'next/navigation'
79

@@ -32,11 +34,12 @@ export async function generateStaticParams() {
3234
*/
3335
export async function generateMetadata({
3436
params
35-
}: {
36-
params: {slug: string}
37-
}): Promise<Metadata | null> {
37+
}: DynamicPageProps): Promise<Metadata | null> {
38+
// Get the slug from the params.
39+
const {slug} = await params
40+
3841
// Get the blog post.
39-
const post = await getPostBySlug(params.slug)
42+
const post = await getPostBySlug(slug)
4043

4144
// No post? Bail...
4245
if (!post) {
@@ -54,9 +57,12 @@ export async function generateMetadata({
5457
*
5558
* @see https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#pages
5659
*/
57-
export default async function Post({params}: {params: {slug: string}}) {
60+
export default async function Post({params}: DynamicPageProps) {
61+
// Get the slug from the params.
62+
const {slug} = await params
63+
5864
// Fetch a single post from WordPress.
59-
const post = await getPostBySlug(params.slug)
65+
const post = await getPostBySlug(slug)
6066

6167
// No post? Bail...
6268
if (!post) {
@@ -102,7 +108,7 @@ export default async function Post({params}: {params: {slug: string}}) {
102108
{post.comments.nodes.map((comment) => (
103109
<article key={comment.databaseId}>
104110
<header className="flex items-center gap-2">
105-
<img
111+
<Image
106112
alt={comment.author.node.name}
107113
className="m-0 rounded-full"
108114
height={64}

0 commit comments

Comments
 (0)